mirror of
https://github.com/python/cpython.git
synced 2025-09-23 00:43:12 +00:00
Mods for HP-UX dynamic loading.
This commit is contained in:
parent
73b20df99e
commit
ae311bd503
1 changed files with 42 additions and 1 deletions
|
@ -62,6 +62,7 @@ extern long getmtime(); /* In getmtime.c */
|
||||||
WITH_MAC_DL -- Mac dynamic linking (highly experimental)
|
WITH_MAC_DL -- Mac dynamic linking (highly experimental)
|
||||||
SHORT_EXT -- short extension for dynamic module, e.g. ".so"
|
SHORT_EXT -- short extension for dynamic module, e.g. ".so"
|
||||||
LONG_EXT -- long extension, e.g. "module.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
|
(The other WITH_* symbols are used only once, to set the
|
||||||
appropriate symbols.)
|
appropriate symbols.)
|
||||||
|
@ -69,6 +70,15 @@ extern long getmtime(); /* In getmtime.c */
|
||||||
|
|
||||||
/* Configure dynamic linking */
|
/* 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
|
#ifdef NT
|
||||||
#define DYNAMIC_LINK
|
#define DYNAMIC_LINK
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -124,7 +134,7 @@ typedef void (*dl_funcptr)();
|
||||||
#define LONG_EXT "module.so"
|
#define LONG_EXT "module.so"
|
||||||
#endif /* USE_SHLIB */
|
#endif /* USE_SHLIB */
|
||||||
|
|
||||||
#ifdef USE_DL
|
#if defined(USE_DL) || defined(hpux)
|
||||||
#include "dl.h"
|
#include "dl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -143,8 +153,12 @@ typedef void (*dl_funcptr)();
|
||||||
extern char *getprogramname();
|
extern char *getprogramname();
|
||||||
|
|
||||||
#ifndef FUNCNAME_PATTERN
|
#ifndef FUNCNAME_PATTERN
|
||||||
|
#if defined(__hp9000s300)
|
||||||
|
#define FUNCNAME_PATTERN "_init%s"
|
||||||
|
#else
|
||||||
#define FUNCNAME_PATTERN "init%s"
|
#define FUNCNAME_PATTERN "init%s"
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(SHORT_EXT) && !defined(LONG_EXT)
|
#if !defined(SHORT_EXT) && !defined(LONG_EXT)
|
||||||
#define SHORT_EXT ".o"
|
#define SHORT_EXT ".o"
|
||||||
|
@ -316,7 +330,34 @@ load_dynamic_module(name, namebuf, m, m_ret)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif /* USE_RLD */
|
#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) {
|
if (p == NULL) {
|
||||||
err_setstr(ImportError,
|
err_setstr(ImportError,
|
||||||
"dynamic module does not define init function");
|
"dynamic module does not define init function");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue