diff options
Diffstat (limited to 'bfd/plugin.c')
-rw-r--r-- | bfd/plugin.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/bfd/plugin.c b/bfd/plugin.c index 064e273128..0a29e378d5 100644 --- a/bfd/plugin.c +++ b/bfd/plugin.c @@ -25,7 +25,13 @@ #if BFD_SUPPORTS_PLUGINS #include <assert.h> +#ifdef HAVE_DLFCN_H #include <dlfcn.h> +#elif defined (HAVE_WINDOWS_H) +#include <windows.h> +#else +#error Unknown how to handle dynamic-load-libraries. +#endif #include <stdarg.h> #include "plugin-api.h" #include "sysdep.h" @@ -34,6 +40,37 @@ #include "libiberty.h" #include <dirent.h> +#if !defined (HAVE_DLFCN_H) && defined (HAVE_WINDOWS_H) + +#define RTLD_NOW 0 /* Dummy value. */ + +static void * +dlopen (const char *file, int mode ATTRIBUTE_UNUSED) +{ + return LoadLibrary (file); +} + +static void * +dlsym (void *handle, const char *name) +{ + return GetProcAddress (handle, name); +} + +static int ATTRIBUTE_UNUSED +dlclose (void *handle) +{ + FreeLibrary (handle); + return 0; +} + +static const char * +dlerror (void) +{ + return "Unable to load DLL."; +} + +#endif /* !defined (HAVE_DLFCN_H) && defined (HAVE_WINDOWS_H) */ + #define bfd_plugin_close_and_cleanup _bfd_generic_close_and_cleanup #define bfd_plugin_bfd_free_cached_info _bfd_generic_bfd_free_cached_info #define bfd_plugin_new_section_hook _bfd_generic_new_section_hook |