diff options
author | Mohamed Akram <mohd.akram@outlook.com> | 2024-05-23 00:52:12 +0400 |
---|---|---|
committer | Mohamed Akram <mohd.akram@outlook.com> | 2024-05-23 00:52:12 +0400 |
commit | cce2abf00fa2c9a695f1d0e5c931c70c1ba579cf (patch) | |
tree | 37eb891fbf73760a0a09b7fa7764dfe77a0ed47f /src | |
parent | ba183bcdced98f56701bb5e7d24120de0988ad44 (diff) |
This allows macOS to respect the linking order as on other platforms.
Diffstat (limited to 'src')
-rw-r--r-- | src/Vendor.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/Vendor.c b/src/Vendor.c index 07faaa9..985bd93 100644 --- a/src/Vendor.c +++ b/src/Vendor.c @@ -111,20 +111,12 @@ static XtResource resources[] = { * ***************************************************************************/ -#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__) +#if 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(__APPLE__) -__attribute__((constructor)) -static void __VendorShellHack(void) -{ - vendorShellWidgetClass = (WidgetClass)(&_XawVendorShellClassRec); - _XawFixupVendorShell(); -} -#else int __stdcall DllMain(unsigned long mod_handle, unsigned long flag, void *routine) { @@ -139,7 +131,6 @@ DllMain(unsigned long mod_handle, unsigned long flag, void *routine) } return 1; } -#endif #define vendorShellClassRec _XawVendorShellClassRec @@ -155,6 +146,9 @@ static CompositeClassExtensionRec vendorCompositeExt = { }; #define SuperClass (&wmShellClassRec) +#if defined(__APPLE__) +__attribute__((weak)) +#endif externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = { { /* superclass */ (WidgetClass)SuperClass, @@ -204,10 +198,11 @@ externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = { } }; -#if !defined(__APPLE__) +#if defined(__APPLE__) +__attribute__((weak)) +#endif externaldef(vendorshellwidgetclass) WidgetClass vendorShellWidgetClass = (WidgetClass) (&vendorShellClassRec); -#endif /*************************************************************************** * @@ -348,7 +343,7 @@ XawVendorShellClassPartInit(WidgetClass cclass) } } -#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__) +#if defined(__CYGWIN__) || defined(__MINGW32__) /* shared libraries on these platforms have the wrong semantics */ /* symbols do not get resolved external to the shared library */ void _XawFixupVendorShell() |