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
This commit is contained in:
parent
c2cafe426e
commit
ae408db07f
4 changed files with 76 additions and 6 deletions
|
@ -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; } \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue