diff options
Diffstat (limited to 'binutils-2.22/gold/plugin.cc')
-rw-r--r-- | binutils-2.22/gold/plugin.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/binutils-2.22/gold/plugin.cc b/binutils-2.22/gold/plugin.cc index 5aadc55..2a2a43f 100644 --- a/binutils-2.22/gold/plugin.cc +++ b/binutils-2.22/gold/plugin.cc @@ -29,9 +29,45 @@ #include <vector> #ifdef ENABLE_PLUGINS +#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 +#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 reinterpret_cast<void *>(GetProcAddress (static_cast<HMODULE>(handle), name)); +} + +static int ATTRIBUTE_UNUSED +dlclose (void *handle) +{ + FreeLibrary (static_cast<HMODULE>(handle)); + return 0; +} + +static const char * +dlerror (void) +{ + return "Unable to load DLL."; +} + +#endif /* !defined (HAVE_DLFCN_H) && defined (HAVE_WINDOWS_H) */ +#endif /* ENABLE_PLUGINS */ + #include "parameters.h" #include "errors.h" #include "fileread.h" |