Index: bfd/plugin.c |
diff --git a/bfd/plugin.c b/bfd/plugin.c |
index 064e2731282fc43f2698a098614af937d8f6db50..8d2c4b2014f782d23444e5280059e62cbba40a74 100644 |
--- a/bfd/plugin.c |
+++ b/bfd/plugin.c |
@@ -1,5 +1,5 @@ |
/* Plugin support for BFD. |
- Copyright 2009, 2010, 2011 |
+ Copyright 2009, 2010, 2011, 2012 |
Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
@@ -19,21 +19,57 @@ |
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
MA 02110-1301, USA. */ |
-#include "config.h" |
+#include "sysdep.h" |
#include "bfd.h" |
#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" |
#include "plugin.h" |
#include "libbfd.h" |
#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 |