#include <a.out.h>
#include <ldfcn.h>
+/* When using Perl extensions written in C++ the longer versions
+ * of load() and unload() from libC and libC_r need to be used,
+ * otherwise statics in the extensions won't get initialized right.
+ * -- Stephanie Beals <bealzy@us.ibm.com> */
+#ifdef USE_xlC /* The define comes, when it comes, from hints/aix.pl. */
+# define LOAD loadAndInitialize
+# define UNLOAD terminateAndUnload
+# include <load.h>
+#else
+# define LOAD load
+# define UNLOAD unload
+#endif
+
/*
* AIX 4.3 does remove some useful definitions from ldfcn.h. Define
* these here to compensate for that lossage.
* load should be declared load(const char *...). Thus we
* cast the path to a normal char *. Ugly.
*/
- if ((mp->entry = (void *)load((char *)path,
+ if ((mp->entry = (void *)LOAD((char *)path,
#ifdef L_LIBPATH_EXEC
L_LIBPATH_EXEC |
#endif
if (--mp->refCnt > 0)
return 0;
- result = unload(mp->entry);
+ result = UNLOAD(mp->entry);
if (result == -1) {
errvalid++;
strerrorcpy(errbuf, errno);
}
/*
* Traverse the list of loaded modules. The entry point
- * returned by load() does actually point to the data
+ * returned by LOAD() does actually point to the data
* segment origin.
*/
lp = (struct ld_info *)buf;