summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-01-27 17:53:11 (GMT)
committerGuido van Rossum <guido@python.org>1999-01-27 17:53:11 (GMT)
commit54ecc3d24f52ae45ca54a24167e434915c88b60f (patch)
tree2bc2d15f1e6a6178a992a9ce0b4975697f1ef71b /Python
parentb5cebfe164fbf6c862e8aa9fb91628d1b8cf76be (diff)
downloadcpython-54ecc3d24f52ae45ca54a24167e434915c88b60f.zip
cpython-54ecc3d24f52ae45ca54a24167e434915c88b60f.tar.gz
cpython-54ecc3d24f52ae45ca54a24167e434915c88b60f.tar.bz2
Patches by William Lewis for Nextstep descendants.
Diffstat (limited to 'Python')
-rw-r--r--Python/getversion.c4
-rw-r--r--Python/importdl.c75
-rw-r--r--Python/strdup.c6
3 files changed, 74 insertions, 11 deletions
diff --git a/Python/getversion.c b/Python/getversion.c
index ead8e77..9f57d6e 100644
--- a/Python/getversion.c
+++ b/Python/getversion.c
@@ -38,8 +38,8 @@ PERFORMANCE OF THIS SOFTWARE.
const char *
Py_GetVersion()
{
- static char version[80];
- sprintf(version, "%.10s (%.30s) %.30s", PY_VERSION,
+ static char version[100];
+ sprintf(version, "%.10s (%.40s) %.40s", PY_VERSION,
Py_GetBuildInfo(), Py_GetCompiler());
return version;
}
diff --git a/Python/importdl.c b/Python/importdl.c
index 073e23f..3b43bbc 100644
--- a/Python/importdl.c
+++ b/Python/importdl.c
@@ -46,7 +46,8 @@ PERFORMANCE OF THIS SOFTWARE.
symbol -- defined for:
DYNAMIC_LINK -- any kind of dynamic linking
- USE_RLD -- NeXT dynamic linking
+ USE_RLD -- NeXT dynamic linking with FVM shlibs
+ USE_DYLD -- NeXT dynamic linking with frameworks
USE_DL -- Jack's dl for IRIX 4 or GNU dld with emulation for Jack's dl
USE_SHLIB -- SunOS or IRIX 5 (SVR4?) shared libraries
_AIX -- AIX style dynamic linking
@@ -117,7 +118,15 @@ typedef FARPROC dl_funcptr;
#endif
#endif
-#ifdef NeXT
+#ifdef WITH_DYLD
+#define DYNAMIC_LINK
+#define USE_DYLD
+#define SHORT_EXT ".so"
+#define LONG_EXT "module.so"
+#define FUNCNAME_PATTERN "_init%.200s"
+#endif
+
+#if defined(NeXT) && !defined(DYNAMIC_LINK)
#define DYNAMIC_LINK
#define USE_RLD
/* Define this to 1 if you want be able to load ObjC modules as well:
@@ -251,16 +260,22 @@ typedef void (*dl_funcptr)();
#ifdef USE_RLD
#include <mach-o/rld.h>
-#define FUNCNAME_PATTERN "_init%.200s"
#ifndef _DL_FUNCPTR_DEFINED
typedef void (*dl_funcptr)();
#endif
#endif /* USE_RLD */
+#ifdef USE_DYLD
+#include <mach-o/dyld.h>
+#ifndef _DL_FUNCPTR_DEFINED
+typedef void (*dl_funcptr)();
+#endif
+#endif /* USE_DYLD */
+
extern char *Py_GetProgramName();
#ifndef FUNCNAME_PATTERN
-#if defined(__hp9000s300) || (defined(__NetBSD__) || defined(__FreeBSD__)) && !defined(__ELF__) || defined(__OpenBSD__) || defined(__BORLANDC__)
+#if defined(__hp9000s300) || (defined(__NetBSD__) || defined(__FreeBSD__)) && !defined(__ELF__) || defined(__OpenBSD__) || defined(__BORLANDC__) || defined(NeXT)
#define FUNCNAME_PATTERN "_init%.200s"
#else
#define FUNCNAME_PATTERN "init%.200s"
@@ -653,6 +668,58 @@ _PyImport_LoadDynamicModule(name, pathname, fp)
return NULL;
}
#endif /* USE_RLD */
+#ifdef USE_DYLD
+ /* This is also NeXT-specific. However, frameworks (the new style
+ of shared library) and rld() can't be used in the same program;
+ instead, you have to use dyld, which is mostly unimplemented. */
+ {
+ NSObjectFileImageReturnCode rc;
+ NSObjectFileImage image;
+ NSModule newModule;
+ NSSymbol theSym;
+ void *symaddr;
+ const char *errString;
+
+ rc = NSCreateObjectFileImageFromFile(pathname, &image);
+ switch(rc) {
+ default:
+ case NSObjectFileImageFailure:
+ NSObjectFileImageFormat:
+ /* for these a message is printed on stderr by dyld */
+ errString = "Can't create object file image";
+ break;
+ case NSObjectFileImageSuccess:
+ errString = NULL;
+ break;
+ case NSObjectFileImageInappropriateFile:
+ errString = "Inappropriate file type for dynamic loading";
+ break;
+ case NSObjectFileImageArch:
+ errString = "Wrong CPU type in object file";
+ break;
+ NSObjectFileImageAccess:
+ errString = "Can't read object file (no access)";
+ break;
+ }
+ if (errString == NULL) {
+ newModule = NSLinkModule(image, pathname, TRUE);
+ if (!newModule)
+ errString = "Failure linking new module";
+ }
+ if (errString != NULL) {
+ PyErr_SetString(PyExc_ImportError, errString);
+ return NULL;
+ }
+ if (!NSIsSymbolNameDefined(funcname)) {
+ /* UnlinkModule() isn't implimented in current versions, but calling it does no harm */
+ NSUnLinkModule(newModule, FALSE);
+ PyErr_Format(PyExc_ImportError, "Loaded module does not contain symbol %s", funcname);
+ return NULL;
+ }
+ theSym = NSLookupAndBindSymbol(funcname);
+ p = (dl_funcptr)NSAddressOfSymbol(theSym);
+ }
+#endif /* USE_DYLD */
#ifdef hpux
{
shl_t lib;
diff --git a/Python/strdup.c b/Python/strdup.c
index d21a0bc..9168b4f 100644
--- a/Python/strdup.c
+++ b/Python/strdup.c
@@ -1,10 +1,6 @@
/* strdup() replacement (from stdwin, if you must know) */
-#include "config.h"
-#include "myproto.h"
-#include "mymalloc.h"
-
-#include <string.h>
+#include "pgenheaders.h"
char *
strdup(str)