Constructors on AIX
Submitted by The Written Word
Link to original bug (#763560)
Description
Created attachment 323776 Constructor patch for AIX
I have a build of glib-2.46.2 on AIX that has constructors working. Supporting constructors on this platform is problematic because you need the support of the compiler and the linker.
I have attached a patch of my work. Explanations:
- The constructor/destructor must not be static. Maybe we redefine G_DEFINE_DESTRUCTOR to G_DEFINE_DESTRUCTOR_PROTO and then use G_DEFINE_DESTRUCTOR in the .c file to define the constructor? We could then continue with the preprocessor-like method in glib/gconstructor.h and support static-less constructors on AIX.
- The library with the constructor must be linked with
-Wl,-binitfini:
<constructor>
:<destructor>
. I added AIX_LDFLAGS to glib/Makefile.am and gobject/Makefile.am for manual massaging at build time. We could fix this in configure.ac as well.
Patch 323776, "Constructor patch for AIX":
aix-constructor.patch
Version: 2.46.x