aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32-gettext.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2010-09-16 18:44:32 +0000
committerWerner Koch <[email protected]>2010-09-16 18:44:32 +0000
commitd717d13e27cb02fbbb015854e3811d9b0aad3c06 (patch)
treecee32f9cc1af12dba5ddae78a4f3941f8ae21079 /src/w32-gettext.c
parentUpdate pl.po. (diff)
downloadlibgpg-error-d717d13e27cb02fbbb015854e3811d9b0aad3c06.tar.gz
libgpg-error-d717d13e27cb02fbbb015854e3811d9b0aad3c06.zip
Fix initialization of static libs
Diffstat (limited to 'src/w32-gettext.c')
-rw-r--r--src/w32-gettext.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/w32-gettext.c b/src/w32-gettext.c
index e67e301..ca4fbbd 100644
--- a/src/w32-gettext.c
+++ b/src/w32-gettext.c
@@ -1146,13 +1146,32 @@ static char *current_domainname;
-/* Constructor for this module. Called from DllMain. */
+/* Constructor for this module. This can only be used if we are a
+ DLL. IF used as a static lib we can't control the process set; for
+ example it might be used with a main module which is not build with
+ mingw and thus does not know how to call the constructors. */
+#ifdef DLL_EXPORT
static void module_init (void) __attribute__ ((__constructor__));
+#endif
static void
module_init (void)
{
- InitializeCriticalSection (&domainlist_access_cs);
+ static int init_done;
+
+ if (!init_done)
+ {
+ InitializeCriticalSection (&domainlist_access_cs);
+ init_done = 1;
+ }
+}
+
+#ifndef DLL_EXPORT
+void
+_gpg_w32__init_gettext_module (void)
+{
+ module_init ();
}
+#endif
/* Free the domain data. */