diff options
author | Andrew MacIntyre <andymac@bullseye.apana.org.au> | 2002-02-17 05:23:30 (GMT) |
---|---|---|
committer | Andrew MacIntyre <andymac@bullseye.apana.org.au> | 2002-02-17 05:23:30 (GMT) |
commit | 41d97d677761032a12b1efdf1f61bec6b0b37235 (patch) | |
tree | 9f13f36d9945cfb4736fa62a88946a763e7e2238 /PC/os2emx/dllentry.c | |
parent | 18e6778bcdffc68c5b954cb41a6031698e67082e (diff) | |
download | cpython-41d97d677761032a12b1efdf1f61bec6b0b37235.zip cpython-41d97d677761032a12b1efdf1f61bec6b0b37235.tar.gz cpython-41d97d677761032a12b1efdf1f61bec6b0b37235.tar.bz2 |
Create and populate OS/2 EMX port build directory:
PC/os2emx/
Makefile
README.os2emx
config.c
dlfcn.c // libdl emulation code for loadable extensions
dlfcn.h
dllentry.c // DLL initialisation routine for Python DLL
getpath.c
pyconfig.h
python23.def // Python DLL symbol export definitions
pythonpm.c // console-less PM interpreter wrapper
Diffstat (limited to 'PC/os2emx/dllentry.c')
-rw-r--r-- | PC/os2emx/dllentry.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/PC/os2emx/dllentry.c b/PC/os2emx/dllentry.c new file mode 100644 index 0000000..511c3d9 --- /dev/null +++ b/PC/os2emx/dllentry.c @@ -0,0 +1,54 @@ +/* + This is the entry point for Python DLL(s). + It also provides an getenv() function that works from within DLLs. +*/ + +#define NULL 0 + +/* Make references to imported symbols to pull them from static library */ +#define REF(s) extern void s (); void *____ref_##s = &s; + +REF (Py_Main); + +#if defined (__EMX__) + +#include <signal.h> + +extern int _CRT_init (void); +extern void _CRT_term (void); +extern void __ctordtorInit (void); +extern void __ctordtorTerm (void); + +unsigned long _DLL_InitTerm (unsigned long mod_handle, unsigned long flag) +{ + switch (flag) + { + case 0: + if (_CRT_init ()) return 0; + __ctordtorInit (); + /* Ignore fatal signals */ + signal (SIGSEGV, SIG_IGN); + signal (SIGFPE, SIG_IGN); + return 1; + case 1: + __ctordtorTerm (); + _CRT_term (); + return 1; + default: + return 0; + } +} + +#endif + +/* A version of getenv() that works from DLLs */ +extern int DosScanEnv (const char *pszName, char **ppszValue); + +char *getenv (const char *name) +{ + char *value; + if (DosScanEnv (name, &value)) + return NULL; + else + return value; +} |