From 7093aeefa2fd37510ed428c94ee4348ae7957ab3 Mon Sep 17 00:00:00 2001 From: "mhammond%skippinet.com.au" Date: Mon, 29 Apr 2002 23:22:16 +0000 Subject: [PATCH] Yet another attempt at portable library init and finalize. Thanks to Christof Meerwald. Not part of the build; global "a=" for this part of the tree. git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_0_BRANCH@120249 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/extensions/python/xpcom/src/dllmain.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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)