diff options
Diffstat (limited to 'gold/plugin.cc')
-rw-r--r-- | gold/plugin.cc | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/gold/plugin.cc b/gold/plugin.cc index c39e11ec..9176e06 100644 --- a/gold/plugin.cc +++ b/gold/plugin.cc @@ -1,6 +1,6 @@ // plugin.cc -- plugin manager for gold -*- C++ -*- -// Copyright 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +// Copyright 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. // Written by Cary Coutant <ccoutant@google.com>. // This file is part of gold. @@ -29,9 +29,39 @@ #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 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" |