summaryrefslogtreecommitdiffstats
path: root/Python/importdl.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-05-23 22:51:40 (GMT)
committerGuido van Rossum <guido@python.org>1996-05-23 22:51:40 (GMT)
commitdadc824c6e927ea76f3a6cec4d0ffcfc88414783 (patch)
treee622ee1b191a8bccc68d57c1c898ce5f8b456a95 /Python/importdl.c
parent40f470f7e024430d21c0976862f6f3bc1a55c0b9 (diff)
downloadcpython-dadc824c6e927ea76f3a6cec4d0ffcfc88414783.zip
cpython-dadc824c6e927ea76f3a6cec4d0ffcfc88414783.tar.gz
cpython-dadc824c6e927ea76f3a6cec4d0ffcfc88414783.tar.bz2
removed verbose decl; added win3.1 dynamic linking.
Diffstat (limited to 'Python/importdl.c')
-rw-r--r--Python/importdl.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/Python/importdl.c b/Python/importdl.c
index 551f8b4..832f022 100644
--- a/Python/importdl.c
+++ b/Python/importdl.c
@@ -29,8 +29,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "osdefs.h"
#include "importdl.h"
-extern int verbose; /* Defined in pythonrun.c */
-
/* Explanation of some of the the various #defines used by dynamic linking...
symbol -- defined for:
@@ -41,6 +39,7 @@ extern int verbose; /* Defined in pythonrun.c */
USE_SHLIB -- SunOS or IRIX 5 (SVR4?) shared libraries
_AIX -- AIX style dynamic linking
NT -- NT style dynamic linking (using DLLs)
+ WIN16_DL -- Windows 16-bit dynamic linking (using DLLs)
_DL_FUNCPTR_DEFINED -- if the typedef dl_funcptr has been defined
USE_MAC_DYNAMIC_LOADING -- Mac CFM shared libraries
SHORT_EXT -- short extension for dynamic module, e.g. ".so"
@@ -79,7 +78,11 @@ typedef void (*dl_funcptr)();
#define NT
#endif
-#ifdef NT
+#ifdef MS_WIN16
+#define WIN16_DL
+#endif
+
+#if defined(NT) || defined(WIN16_DL)
#define DYNAMIC_LINK
#include <windows.h>
typedef FARPROC dl_funcptr;
@@ -377,6 +380,19 @@ load_dynamic_module(name, pathname, fp)
p = GetProcAddress(hDLL, funcname);
}
#endif /* NT */
+#ifdef WIN16_DL
+ {
+ HINSTANCE hDLL;
+ hDLL = LoadLibrary(pathname);
+ if (hDLL < HINSTANCE_ERROR){
+ char errBuf[256];
+ sprintf(errBuf, "DLL load failed with error code %d", hDLL);
+ err_setstr(ImportError, errBuf);
+ return NULL;
+ }
+ p = GetProcAddress(hDLL, funcname);
+ }
+#endif /* WIN16_DL */
#ifdef USE_DL
p = dl_loadmod(getprogramname(), pathname, funcname);
#endif /* USE_DL */