Last change
on this file was 391, checked in by dmik, 11 years ago |
python: Merge vendor 2.7.6 to trunk.
|
-
Property svn:eol-style
set to
native
|
File size:
1.2 KB
|
Rev | Line | |
---|
[2] | 1 |
|
---|
| 2 | /* Support for dynamic loading of extension modules */
|
---|
| 3 |
|
---|
| 4 | #define INCL_DOSERRORS
|
---|
| 5 | #define INCL_DOSMODULEMGR
|
---|
| 6 | #include <os2.h>
|
---|
| 7 |
|
---|
| 8 | #include "Python.h"
|
---|
| 9 | #include "importdl.h"
|
---|
| 10 |
|
---|
| 11 |
|
---|
| 12 | const struct filedescr _PyImport_DynLoadFiletab[] = {
|
---|
[391] | 13 | {".pyd", "rb", C_EXTENSION},
|
---|
| 14 | {".dll", "rb", C_EXTENSION},
|
---|
| 15 | {0, 0}
|
---|
[2] | 16 | };
|
---|
| 17 |
|
---|
| 18 | dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname,
|
---|
[391] | 19 | const char *pathname, FILE *fp)
|
---|
[2] | 20 | {
|
---|
[391] | 21 | dl_funcptr p;
|
---|
| 22 | APIRET rc;
|
---|
| 23 | HMODULE hDLL;
|
---|
| 24 | char failreason[256];
|
---|
| 25 | char funcname[258];
|
---|
[2] | 26 |
|
---|
[391] | 27 | rc = DosLoadModule(failreason,
|
---|
| 28 | sizeof(failreason),
|
---|
| 29 | pathname,
|
---|
| 30 | &hDLL);
|
---|
[2] | 31 |
|
---|
[391] | 32 | if (rc != NO_ERROR) {
|
---|
| 33 | char errBuf[256];
|
---|
| 34 | PyOS_snprintf(errBuf, sizeof(errBuf),
|
---|
| 35 | "DLL load failed, rc = %d: %.200s",
|
---|
| 36 | rc, failreason);
|
---|
| 37 | PyErr_SetString(PyExc_ImportError, errBuf);
|
---|
| 38 | return NULL;
|
---|
| 39 | }
|
---|
[2] | 40 |
|
---|
[391] | 41 | PyOS_snprintf(funcname, sizeof(funcname), "init%.200s", shortname);
|
---|
| 42 | rc = DosQueryProcAddr(hDLL, 0L, funcname, &p);
|
---|
| 43 | if (rc != NO_ERROR)
|
---|
| 44 | p = NULL; /* Signify Failure to Acquire Entrypoint */
|
---|
| 45 | return p;
|
---|
[2] | 46 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.