aboutsummaryrefslogtreecommitdiff
path: root/base/plugins.h
diff options
context:
space:
mode:
authorAndre Heider2010-09-06 20:34:00 +0000
committerAndre Heider2010-09-06 20:34:00 +0000
commitae408db07f05407c41ed4831e4e23991574588d6 (patch)
treee12b3d57b671c1d2c437e788059036fde3aea66f /base/plugins.h
parentc2cafe426e8216d46a70b479ff0071a8b66b9327 (diff)
downloadscummvm-rg350-ae408db07f05407c41ed4831e4e23991574588d6.tar.gz
scummvm-rg350-ae408db07f05407c41ed4831e4e23991574588d6.tar.bz2
scummvm-rg350-ae408db07f05407c41ed4831e4e23991574588d6.zip
PLUGINS: Use the C++ ABI to call dtors when unloading a plugin.
Avoid linking all plugins against libstdc++ to free up some memory (about ~40kb on Wii per plugin). Enable it on GameCube, Wii, DS and PSP (PS2 doesn't have __cxa_atexit support in its libc). svn-id: r52607
Diffstat (limited to 'base/plugins.h')
-rw-r--r--base/plugins.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/base/plugins.h b/base/plugins.h
index 84b1af5599..eb7e93ddba 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -90,6 +90,13 @@ extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
#define PLUGIN_ENABLED_DYNAMIC(ID) \
(ENABLE_##ID && (ENABLE_##ID == DYNAMIC_PLUGIN) && DYNAMIC_MODULES)
+// see comments in backends/plugins/elf/elf-provider.cpp
+#if defined(ELF_LOADER_TARGET) && defined(ELF_LOADER_CXA_ATEXIT)
+#define PLUGIN_DYNAMIC_EXTRA_DECL uint32 __dso_handle __attribute__((visibility ("hidden"))) = 0
+#else
+#define PLUGIN_DYNAMIC_EXTRA_DECL
+#endif
+
/**
* REGISTER_PLUGIN_STATIC is a convenience macro which is used to declare
* the plugin interface for static plugins. Code (such as game engines)
@@ -119,6 +126,7 @@ extern int pluginTypeVersions[PLUGIN_TYPE_MAX];
*/
#define REGISTER_PLUGIN_DYNAMIC(ID,TYPE,PLUGINCLASS) \
extern "C" { \
+ PLUGIN_DYNAMIC_EXTRA_DECL; \
PLUGIN_EXPORT int32 PLUGIN_getVersion() { return PLUGIN_VERSION; } \
PLUGIN_EXPORT int32 PLUGIN_getType() { return TYPE; } \
PLUGIN_EXPORT int32 PLUGIN_getTypeVersion() { return TYPE##_VERSION; } \