summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-09-12 10:39:56 (GMT)
committerGuido van Rossum <guido@python.org>1994-09-12 10:39:56 (GMT)
commitae311bd50361f38f689791d6099ca634ff33e046 (patch)
treed0a78517369e94381e40dd1254486dffbb360376 /Python
parent73b20df99e2443139bf4dcc6b47b2334a6606572 (diff)
downloadcpython-ae311bd50361f38f689791d6099ca634ff33e046.zip
cpython-ae311bd50361f38f689791d6099ca634ff33e046.tar.gz
cpython-ae311bd50361f38f689791d6099ca634ff33e046.tar.bz2
Mods for HP-UX dynamic loading.
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c
index 980ccd2..1a13fcf 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -62,6 +62,7 @@ extern long getmtime(); /* In getmtime.c */
WITH_MAC_DL -- Mac dynamic linking (highly experimental)
SHORT_EXT -- short extension for dynamic module, e.g. ".so"
LONG_EXT -- long extension, e.g. "module.so"
+ hpux -- HP-UX Dynamic Linking - defined by the compiler
(The other WITH_* symbols are used only once, to set the
appropriate symbols.)
@@ -69,6 +70,15 @@ extern long getmtime(); /* In getmtime.c */
/* Configure dynamic linking */
+#ifdef hpux
+#define DYNAMIC_LINK
+#include <errno.h>
+typedef void (*dl_funcptr)();
+#define _DL_FUNCPTR_DEFINED 1
+#define SHORT_EXT ".sl"
+#define LONG_EXT "module.sl"
+#endif
+
#ifdef NT
#define DYNAMIC_LINK
#include <windows.h>
@@ -124,7 +134,7 @@ typedef void (*dl_funcptr)();
#define LONG_EXT "module.so"
#endif /* USE_SHLIB */
-#ifdef USE_DL
+#if defined(USE_DL) || defined(hpux)
#include "dl.h"
#endif
@@ -143,8 +153,12 @@ typedef void (*dl_funcptr)();
extern char *getprogramname();
#ifndef FUNCNAME_PATTERN
+#if defined(__hp9000s300)
+#define FUNCNAME_PATTERN "_init%s"
+#else
#define FUNCNAME_PATTERN "init%s"
#endif
+#endif
#if !defined(SHORT_EXT) && !defined(LONG_EXT)
#define SHORT_EXT ".o"
@@ -316,7 +330,34 @@ load_dynamic_module(name, namebuf, m, m_ret)
return NULL;
}
#endif /* USE_RLD */
+#ifdef hpux
+ {
+ shl_t lib;
+ int flags;
+ flags = BIND_DEFERRED;
+ if (verbose)
+ {
+ flags = BIND_IMMEDIATE | BIND_NONFATAL | BIND_VERBOSE;
+ printf("shl_load %s\n",namebuf);
+ }
+ lib = shl_load(namebuf, flags, 0);
+ if (lib == NULL)
+ {
+ char buf[256];
+ if (verbose)
+ perror(namebuf);
+ sprintf(buf,"Failed to load %s", namebuf);
+ err_setstr(ImportError, buf);
+ return NULL;
+ }
+ if (verbose)
+ printf("shl_findsym %s\n", funcname);
+ shl_findsym(&lib, funcname, TYPE_UNDEFINED, (void *) &p);
+ if (p == NULL && verbose)
+ perror(funcname);
+ }
+#endif hpux
if (p == NULL) {
err_setstr(ImportError,
"dynamic module does not define init function");