diff options
author | Max Horn | 2006-10-07 00:31:33 +0000 |
---|---|---|
committer | Max Horn | 2006-10-07 00:31:33 +0000 |
commit | 8d82ffd31b1b85f94f5ef3a17a5a51ae5855990d (patch) | |
tree | 4c407f207370a71e4a39ecaf19cb2c6a022b977c /backends/plugins/posix | |
parent | 26e4e1680050448ad85693d7be5cb07abdeab89c (diff) | |
download | scummvm-rg350-8d82ffd31b1b85f94f5ef3a17a5a51ae5855990d.tar.gz scummvm-rg350-8d82ffd31b1b85f94f5ef3a17a5a51ae5855990d.tar.bz2 scummvm-rg350-8d82ffd31b1b85f94f5ef3a17a5a51ae5855990d.zip |
Added plugin providers for Win32 and DC
svn-id: r24149
Diffstat (limited to 'backends/plugins/posix')
-rw-r--r-- | backends/plugins/posix/posix-provider.cpp | 61 | ||||
-rw-r--r-- | backends/plugins/posix/posix-provider.h | 4 |
2 files changed, 5 insertions, 60 deletions
diff --git a/backends/plugins/posix/posix-provider.cpp b/backends/plugins/posix/posix-provider.cpp index bbc03938fe..52bc7751b1 100644 --- a/backends/plugins/posix/posix-provider.cpp +++ b/backends/plugins/posix/posix-provider.cpp @@ -21,33 +21,15 @@ * */ -#ifdef DYNAMIC_MODULES +#if defined(DYNAMIC_MODULES) && defined(UNIX) #include "backends/plugins/posix/posix-provider.h" #include "backends/plugins/dynamic-plugin.h" #include "common/fs.h" -#include "common/util.h" - -#if defined(UNIX) #include <dlfcn.h> #define PLUGIN_DIRECTORY "plugins/" -#elif defined(__DC__) -#include "dcloader.h" -#define PLUGIN_DIRECTORY "/" -#define PLUGIN_PREFIX "" -#define PLUGIN_SUFFIX ".PLG" - -#elif defined(_WIN32) -#define PLUGIN_DIRECTORY "" -#define PLUGIN_PREFIX "" -#define PLUGIN_SUFFIX ".dll" -#else -#error No support for loading plugins on non-unix systems at this point! -#endif - - class POSIXPlugin : public DynamicPlugin { protected: @@ -55,19 +37,9 @@ protected: Common::String _filename; virtual VoidFunc findSymbol(const char *symbol) { - #if defined(UNIX) || defined(__DC__) void *func = dlsym(_dlHandle, symbol); if (!func) warning("Failed loading symbol '%s' from plugin '%s' (%s)", symbol, _filename.c_str(), dlerror()); - #else - #if defined(_WIN32) - void *func = (void *)GetProcAddress((HMODULE)_dlHandle, symbol); - if (!func) - warning("Failed loading symbol '%s' from plugin '%s'", symbol, _filename.c_str()); - #else - #error TODO - #endif - #endif // FIXME HACK: This is a HACK to circumvent a clash between the ISO C++ // standard and POSIX: ISO C++ disallows casting between function pointers @@ -85,46 +57,19 @@ public: bool loadPlugin() { assert(!_dlHandle); - #if defined(UNIX) || defined(__DC__) _dlHandle = dlopen(_filename.c_str(), RTLD_LAZY); if (!_dlHandle) { warning("Failed loading plugin '%s' (%s)", _filename.c_str(), dlerror()); return false; } - #else - #if defined(_WIN32) - _dlHandle = LoadLibrary(_filename.c_str()); - - if (!_dlHandle) { - warning("Failed loading plugin '%s'", _filename.c_str()); - return false; - } - #else - #error TODO - #endif - #endif - bool ret = DynamicPlugin::loadPlugin(); - - #ifdef __DC__ - if (ret) - dlforgetsyms(_dlHandle); - #endif - - return ret; + return DynamicPlugin::loadPlugin(); } void unloadPlugin() { if (_dlHandle) { - #if defined(UNIX) || defined(__DC__) if (dlclose(_dlHandle) != 0) warning("Failed unloading plugin '%s' (%s)", _filename.c_str(), dlerror()); - #elif defined(_WIN32) - if (!FreeLibrary((HMODULE)_dlHandle)) - warning("Failed unloading plugin '%s'", _filename.c_str()); - #else - #error TODO - #endif } } }; @@ -175,4 +120,4 @@ PluginList POSIXPluginProvider::getPlugins() { } -#endif // DYNAMIC_MODULES +#endif // defined(DYNAMIC_MODULES) && defined(UNIX) diff --git a/backends/plugins/posix/posix-provider.h b/backends/plugins/posix/posix-provider.h index 2c26751fb1..54f7f7406b 100644 --- a/backends/plugins/posix/posix-provider.h +++ b/backends/plugins/posix/posix-provider.h @@ -27,7 +27,7 @@ #include "common/stdafx.h" #include "base/plugins.h" -#ifdef DYNAMIC_MODULES +#if defined(DYNAMIC_MODULES) && defined(UNIX) class POSIXPluginProvider : public PluginProvider { public: @@ -37,6 +37,6 @@ public: virtual PluginList getPlugins(); }; -#endif +#endif // defined(DYNAMIC_MODULES) && defined(UNIX) #endif |