I have a build of glib-2.46.2 on HP-UX/PA and HP-UX/IA that has constructors working. Getting it to work on HP-UX/PA wasn't too difficult but HP-UX/IA was a bit more involved. This email is to discuss the solution on HP-UX/IA. Support for constructors currently requires the help of the preprocessor, using glib/gconstructor.h. This works ok on HP-UX/PA but not HP-UX/IA. According to the HP-UX/IA compiler documentation: The #pragma directive is ignored by the preprocessor, and instead is passed on to the HP aC++ compiler. So, on HP-UX/IA, G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS cannot work because the HP-UX C compiler passes the raw string to #pragma. Is there a cleaner solution than adding something like: #ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA #pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(glib_init_ctor) +#elif defined(__hpux) && defined(__ia64) +#pragma INIT "glib_init_ctor" #endif I've attached my current patch. -- albert chin (china thewrittenword com)
Attachment:
hpux-constructor.patch
Description: Text Data