Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6a75d26

Browse files
committed
ported to 68K Mac; changed suffix to .slb
1 parent 0acd4b6 commit 6a75d26

1 file changed

Lines changed: 18 additions & 26 deletions

File tree

Python/importdl.c

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ extern int verbose; /* Defined in pythonrun.c */
4242
_AIX -- AIX style dynamic linking
4343
NT -- NT style dynamic linking (using DLLs)
4444
_DL_FUNCPTR_DEFINED -- if the typedef dl_funcptr has been defined
45-
WITH_MAC_DL -- Mac dynamic linking (highly experimental)
46-
USE_MAC_SHARED_LIBRARY -- Another mac dynamic linking method
45+
USE_MAC_SHARED_LIBRARY -- Mac CFM shared libraries
4746
SHORT_EXT -- short extension for dynamic module, e.g. ".so"
4847
LONG_EXT -- long extension, e.g. "module.so"
4948
hpux -- HP-UX Dynamic Linking - defined by the compiler
@@ -95,14 +94,14 @@ typedef FARPROC dl_funcptr;
9594
#define USE_DL
9695
#endif
9796

98-
#ifdef WITH_MAC_DL
99-
#define DYNAMIC_LINK
97+
#ifdef __CFM68K__
98+
#define USE_MAC_SHARED_LIBRARY
10099
#endif
101100

102101
#ifdef USE_MAC_SHARED_LIBRARY
103102
#define DYNAMIC_LINK
104-
#define SHORT_EXT ".shlb"
105-
#define LONG_EXT "module.shlb"
103+
#define SHORT_EXT ".slb"
104+
#define LONG_EXT "module.slb"
106105
#ifndef _DL_FUNCPTR_DEFINED
107106
typedef void (*dl_funcptr)();
108107
#endif
@@ -144,12 +143,12 @@ typedef void (*dl_funcptr)();
144143
#include "dl.h"
145144
#endif
146145

147-
#ifdef WITH_MAC_DL
148-
#include "dynamic_load.h"
149-
#endif
150-
151146
#ifdef USE_MAC_SHARED_LIBRARY
152147
#include <CodeFragments.h>
148+
#ifdef __SC__ /* Really just an older version of Universal Headers */
149+
#define CFragConnectionID ConnectionID
150+
#define kLoadCFrag 0x01
151+
#endif
153152
#include <Files.h>
154153
#include "macdefs.h"
155154
#include "macglue.h"
@@ -180,7 +179,7 @@ extern char *getprogramname();
180179

181180
#endif /* DYNAMIC_LINK */
182181

183-
/* Max length of module suffix searched for -- accommodates "module.shlb" */
182+
/* Max length of module suffix searched for -- accommodates "module.slb" */
184183
#ifndef MAXSUFFIXSIZE
185184
#define MAXSUFFIXSIZE 12
186185
#endif
@@ -213,29 +212,23 @@ load_dynamic_module(name, pathname)
213212
char funcname[258];
214213
dl_funcptr p = NULL;
215214
sprintf(funcname, FUNCNAME_PATTERN, name);
216-
#ifdef WITH_MAC_DL
217-
{
218-
object *v = dynamic_load(pathname);
219-
if (v == NULL)
220-
return NULL;
221-
}
222-
#else /* !WITH_MAC_DL */
223215
#ifdef USE_MAC_SHARED_LIBRARY
224-
/* Another way to do dynloading on the mac, use CFM */
216+
/* Dynamic loading of CFM shared libraries on the Mac */
225217
{
226218
FSSpec libspec;
227219
CFragConnectionID connID;
228-
Ptr mainAddr;
229-
Str255 errMessage;
230-
OSErr err;
220+
Ptr mainAddr;
221+
Str255 errMessage;
222+
OSErr err;
231223

232224
(void)FSMakeFSSpec(0, 0, Pstring(pathname), &libspec);
233-
err = GetDiskFragment(&libspec, 0, 0, Pstring(name), kLoadCFrag, &connID, &mainAddr,
234-
errMessage);
225+
err = GetDiskFragment(&libspec, 0, 0, Pstring(name),
226+
kLoadCFrag, &connID, &mainAddr,
227+
errMessage);
235228
if ( err ) {
236229
char buf[512];
237230

238-
sprintf(buf, "%#s: %s", errMessage, macstrerror(err));
231+
sprintf(buf, "%#s: %s", errMessage, PyMac_StrError(err));
239232
err_setstr(ImportError, buf);
240233
return NULL;
241234
}
@@ -355,7 +348,6 @@ load_dynamic_module(name, pathname)
355348
}
356349
(*p)();
357350

358-
#endif /* !WITH_MAC_DL */
359351
m = dictlookup(import_modules, name);
360352
if (m == NULL) {
361353
if (err_occurred() == NULL)

0 commit comments

Comments
 (0)