summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaakov Selkowitz <yselkowitz@users.sourceforge.net>2011-08-24 04:59:26 -0500
committerYaakov Selkowitz <yselkowitz@users.sourceforge.net>2011-08-24 23:34:56 -0500
commit1deb6b459446d73b7a837ed1ccc289202b50ef6b (patch)
tree1768a05fa1ff400c695e5085738981ecdab62b60
parenta4c27e1e353978aeb78cfb9a3f4dda7689119ee9 (diff)
Fix DLL initialization on PE platforms
This is borrowed straight from libXaw/src/Vendor.c. Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net> Acked-by: Gaetan Nadon <memsize@videotron.ca>
-rw-r--r--src/Vendor.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/Vendor.c b/src/Vendor.c
index 6a32146..ec615ca 100644
--- a/src/Vendor.c
+++ b/src/Vendor.c
@@ -106,6 +106,50 @@ static void XawVendorShellClassPartInit();
void XawVendorShellExtResize();
#endif
+#if defined(__UNIXOS2__) || defined(__CYGWIN__) || defined(__MINGW32__)
+/* to fix the EditRes problem because of wrong linker semantics */
+extern WidgetClass vendorShellWidgetClass; /* from Xt/Vendor.c */
+extern VendorShellClassRec _XawVendorShellClassRec;
+extern void _XawFixupVendorShell();
+
+#if defined(__UNIXOS2__)
+unsigned long _DLL_InitTerm(unsigned long mod,unsigned long flag)
+{
+ switch (flag) {
+ case 0: /*called on init*/
+ _CRT_init();
+ vendorShellWidgetClass = (WidgetClass)(&_XawVendorShellClassRec$
+ _XawFixupVendorShell();
+ return 1;
+ case 1: /*called on exit*/
+ return 1;
+ default:
+ return 0;
+ }
+}
+#endif
+
+#if defined(__CYGWIN__) || defined(__MINGW32__)
+int __stdcall
+DllMain(unsigned long mod_handle, unsigned long flag, void *routine)
+{
+ switch (flag)
+ {
+ case 1: /* DLL_PROCESS_ATTACH - process attach */
+ vendorShellWidgetClass = (WidgetClass)(&_XawVendorShellClassRec);
+ _XawFixupVendorShell();
+ break;
+ case 0: /* DLL_PROCESS_DETACH - process detach */
+ break;
+ }
+ return 1;
+}
+#endif
+
+#define vendorShellClassRec _XawVendorShellClassRec
+
+#endif
+
#ifdef XAW_INTERNATIONALIZATION
static CompositeClassExtensionRec vendorCompositeExt = {
/* next_extension */ NULL,
@@ -433,7 +477,7 @@ static void XawVendorShellClassPartInit(class)
}
#endif
-#ifdef __osf__
+#if defined(__osf__) || defined(__UNIXOS2__) || defined(__CYGWIN__) || defined(__MINGW32__)
/* stupid OSF/1 shared libraries have the wrong semantics */
/* symbols do not get resolved external to the shared library */
void _XawFixupVendorShell()