From ae408db07f05407c41ed4831e4e23991574588d6 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Mon, 6 Sep 2010 20:34:00 +0000 Subject: 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 --- base/plugins.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'base/plugins.h') 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; } \ -- cgit v1.2.3