Andrew MacIntyre | 41d97d6 | 2002-02-17 05:23:30 +0000 | [diff] [blame] | 1 | /* |
Andrew MacIntyre | 0c83348 | 2003-04-22 03:21:42 +0000 | [diff] [blame] | 2 | * This is the entry point for the Python 2.3 core DLL. |
3 | */ | ||||
Andrew MacIntyre | 41d97d6 | 2002-02-17 05:23:30 +0000 | [diff] [blame] | 4 | |
5 | #define NULL 0 | ||||
6 | |||||
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 7 | #define REF(s) extern void s(); void *____ref_##s = &s; |
Andrew MacIntyre | 41d97d6 | 2002-02-17 05:23:30 +0000 | [diff] [blame] | 8 | |
Andrew MacIntyre | 0c83348 | 2003-04-22 03:21:42 +0000 | [diff] [blame] | 9 | /* Make references to imported symbols to pull them from static library */ |
10 | REF(Py_Main); | ||||
Andrew MacIntyre | 41d97d6 | 2002-02-17 05:23:30 +0000 | [diff] [blame] | 11 | |
Andrew MacIntyre | 41d97d6 | 2002-02-17 05:23:30 +0000 | [diff] [blame] | 12 | #include <signal.h> |
13 | |||||
Andrew MacIntyre | 0c83348 | 2003-04-22 03:21:42 +0000 | [diff] [blame] | 14 | extern int _CRT_init(void); |
15 | extern void _CRT_term(void); | ||||
16 | extern void __ctordtorInit(void); | ||||
17 | extern void __ctordtorTerm(void); | ||||
Andrew MacIntyre | 41d97d6 | 2002-02-17 05:23:30 +0000 | [diff] [blame] | 18 | |
Andrew MacIntyre | 0c83348 | 2003-04-22 03:21:42 +0000 | [diff] [blame] | 19 | unsigned long _DLL_InitTerm(unsigned long mod_handle, unsigned long flag) |
Andrew MacIntyre | 41d97d6 | 2002-02-17 05:23:30 +0000 | [diff] [blame] | 20 | { |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 21 | switch (flag) |
22 | { | ||||
23 | case 0: | ||||
24 | if (_CRT_init()) | ||||
25 | return 0; | ||||
26 | __ctordtorInit(); | ||||
Andrew MacIntyre | d65778a | 2002-12-31 11:23:50 +0000 | [diff] [blame] | 27 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 28 | /* Ignore fatal signals */ |
29 | signal(SIGSEGV, SIG_IGN); | ||||
30 | signal(SIGFPE, SIG_IGN); | ||||
Andrew MacIntyre | d65778a | 2002-12-31 11:23:50 +0000 | [diff] [blame] | 31 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 32 | return 1; |
Andrew MacIntyre | d65778a | 2002-12-31 11:23:50 +0000 | [diff] [blame] | 33 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 34 | case 1: |
35 | __ctordtorTerm(); | ||||
36 | _CRT_term(); | ||||
37 | return 1; | ||||
Andrew MacIntyre | d65778a | 2002-12-31 11:23:50 +0000 | [diff] [blame] | 38 | |
Antoine Pitrou | 7f14f0d | 2010-05-09 16:14:21 +0000 | [diff] [blame] | 39 | default: |
40 | return 0; | ||||
41 | } | ||||
Andrew MacIntyre | 41d97d6 | 2002-02-17 05:23:30 +0000 | [diff] [blame] | 42 | } |