diff --git a/mozilla/extensions/python/xpcom/src/dllmain.cpp b/mozilla/extensions/python/xpcom/src/dllmain.cpp index 397cdb9a497..9f7785e1476 100644 --- a/mozilla/extensions/python/xpcom/src/dllmain.cpp +++ b/mozilla/extensions/python/xpcom/src/dllmain.cpp @@ -187,10 +187,6 @@ void PyXPCOM_DLLRelease(void) PR_AtomicDecrement(&g_cLockCount); } -static void pyxpcom_construct() __attribute__((constructor)); -static void pyxpcom_destruct() __attribute__((destructor)); - - void pyxpcom_construct(void) { PRStatus status; @@ -212,6 +208,16 @@ void pyxpcom_destruct(void) // TlsFree(tlsIndex); } +// Yet another attempt at cross-platform library initialization and finalization. +struct DllInitializer { + DllInitializer() { + pyxpcom_construct(); + } + ~DllInitializer() { + pyxpcom_destruct(); + } +} dll_initializer; + #ifdef XP_WIN extern "C" __declspec(dllexport)