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

Skip to content

Commit dadc824

Browse files
committed
removed verbose decl; added win3.1 dynamic linking.
1 parent 40f470f commit dadc824

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

Python/importdl.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2929
#include "osdefs.h"
3030
#include "importdl.h"
3131

32-
extern int verbose; /* Defined in pythonrun.c */
33-
3432
/* Explanation of some of the the various #defines used by dynamic linking...
3533
3634
symbol -- defined for:
@@ -41,6 +39,7 @@ extern int verbose; /* Defined in pythonrun.c */
4139
USE_SHLIB -- SunOS or IRIX 5 (SVR4?) shared libraries
4240
_AIX -- AIX style dynamic linking
4341
NT -- NT style dynamic linking (using DLLs)
42+
WIN16_DL -- Windows 16-bit dynamic linking (using DLLs)
4443
_DL_FUNCPTR_DEFINED -- if the typedef dl_funcptr has been defined
4544
USE_MAC_DYNAMIC_LOADING -- Mac CFM shared libraries
4645
SHORT_EXT -- short extension for dynamic module, e.g. ".so"
@@ -79,7 +78,11 @@ typedef void (*dl_funcptr)();
7978
#define NT
8079
#endif
8180

82-
#ifdef NT
81+
#ifdef MS_WIN16
82+
#define WIN16_DL
83+
#endif
84+
85+
#if defined(NT) || defined(WIN16_DL)
8386
#define DYNAMIC_LINK
8487
#include <windows.h>
8588
typedef FARPROC dl_funcptr;
@@ -377,6 +380,19 @@ load_dynamic_module(name, pathname, fp)
377380
p = GetProcAddress(hDLL, funcname);
378381
}
379382
#endif /* NT */
383+
#ifdef WIN16_DL
384+
{
385+
HINSTANCE hDLL;
386+
hDLL = LoadLibrary(pathname);
387+
if (hDLL < HINSTANCE_ERROR){
388+
char errBuf[256];
389+
sprintf(errBuf, "DLL load failed with error code %d", hDLL);
390+
err_setstr(ImportError, errBuf);
391+
return NULL;
392+
}
393+
p = GetProcAddress(hDLL, funcname);
394+
}
395+
#endif /* WIN16_DL */
380396
#ifdef USE_DL
381397
p = dl_loadmod(getprogramname(), pathname, funcname);
382398
#endif /* USE_DL */

0 commit comments

Comments
 (0)