Cleanup patches from Greg Stein:
* in import.c, #ifdef out references to dynamic loading based on
HAVE_DYNAMIC_LOADING
* clean out the platform-specific crud from importdl.c.
[ maybe fold this function into import.c and drop the importdl.c file? Greg.]
* change GetDynLoadFunc's "funcname" parameter to "shortname". change
"name" to "fqname" for clarification.
* each GetDynLoadFunc now creates its own funcname value.
WARNING: as I mentioned previously, we may run into an issue with a
missing "_" on some platforms. Testing will show this pretty quickly,
however.
* move pathname munging into dynload_shlib.c
diff --git a/Python/dynload_hpux.c b/Python/dynload_hpux.c
index 4379cbe..b8a5ffc 100644
--- a/Python/dynload_hpux.c
+++ b/Python/dynload_hpux.c
@@ -37,6 +37,11 @@
#include "Python.h"
#include "importdl.h"
+#if defined(__hp9000s300)
+#define FUNCNAME_PATTERN "_init%.200s"
+#else
+#define FUNCNAME_PATTERN "init%.200s"
+#endif
const struct filedescr _PyImport_DynLoadFiletab[] = {
{".sl", "rb", C_EXTENSION},
@@ -44,12 +49,13 @@
{0, 0}
};
-dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname,
+dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
const char *pathname, FILE *fp)
{
dl_funcptr p;
shl_t lib;
int flags;
+ char funcname[258];
flags = BIND_FIRST | BIND_DEFERRED;
if (Py_VerboseFlag) {
@@ -67,6 +73,7 @@
PyErr_SetString(PyExc_ImportError, buf);
return NULL;
}
+ sprintf(funcname, FUNCNAME_PATTERN, shortname);
if (Py_VerboseFlag)
printf("shl_findsym %s\n", funcname);
shl_findsym(&lib, funcname, TYPE_UNDEFINED, (void *) &p);