[PATCH libXaw3d 11/11] Fix DLL initialization on PE platforms
Yaakov (Cygwin/X)
yselkowitz at users.sourceforge.net
Wed Aug 24 04:12:03 PDT 2011
From: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
This is borrowed straight from libXaw/src/Vendor.c.
Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
---
src/Vendor.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
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()
--
1.7.5.1
More information about the xorg-devel
mailing list