blob: 9ccca1c8c82ef4fb5c70e96e107e2cb108eea6da [file] [log] [blame]
Andrew MacIntyre41d97d62002-02-17 05:23:30 +00001/*
Andrew MacIntyre0c833482003-04-22 03:21:42 +00002 * This is the entry point for the Python 2.3 core DLL.
3 */
Andrew MacIntyre41d97d62002-02-17 05:23:30 +00004
5#define NULL 0
6
Antoine Pitrou7f14f0d2010-05-09 16:14:21 +00007#define REF(s) extern void s(); void *____ref_##s = &s;
Andrew MacIntyre41d97d62002-02-17 05:23:30 +00008
Andrew MacIntyre0c833482003-04-22 03:21:42 +00009/* Make references to imported symbols to pull them from static library */
10REF(Py_Main);
Andrew MacIntyre41d97d62002-02-17 05:23:30 +000011
Andrew MacIntyre41d97d62002-02-17 05:23:30 +000012#include <signal.h>
13
Andrew MacIntyre0c833482003-04-22 03:21:42 +000014extern int _CRT_init(void);
15extern void _CRT_term(void);
16extern void __ctordtorInit(void);
17extern void __ctordtorTerm(void);
Andrew MacIntyre41d97d62002-02-17 05:23:30 +000018
Andrew MacIntyre0c833482003-04-22 03:21:42 +000019unsigned long _DLL_InitTerm(unsigned long mod_handle, unsigned long flag)
Andrew MacIntyre41d97d62002-02-17 05:23:30 +000020{
Antoine Pitrou7f14f0d2010-05-09 16:14:21 +000021 switch (flag)
22 {
23 case 0:
24 if (_CRT_init())
25 return 0;
26 __ctordtorInit();
Andrew MacIntyred65778a2002-12-31 11:23:50 +000027
Antoine Pitrou7f14f0d2010-05-09 16:14:21 +000028 /* Ignore fatal signals */
29 signal(SIGSEGV, SIG_IGN);
30 signal(SIGFPE, SIG_IGN);
Andrew MacIntyred65778a2002-12-31 11:23:50 +000031
Antoine Pitrou7f14f0d2010-05-09 16:14:21 +000032 return 1;
Andrew MacIntyred65778a2002-12-31 11:23:50 +000033
Antoine Pitrou7f14f0d2010-05-09 16:14:21 +000034 case 1:
35 __ctordtorTerm();
36 _CRT_term();
37 return 1;
Andrew MacIntyred65778a2002-12-31 11:23:50 +000038
Antoine Pitrou7f14f0d2010-05-09 16:14:21 +000039 default:
40 return 0;
41 }
Andrew MacIntyre41d97d62002-02-17 05:23:30 +000042}