blob: ea8d366eb60adb91eedc2473ac2625b5d64d8b7f [file] [log] [blame]
Andrew MacIntyre41d97d62002-02-17 05:23:30 +00001/*
2 This is the entry point for Python DLL(s).
3 It also provides an getenv() function that works from within DLLs.
4*/
5
6#define NULL 0
7
8/* Make references to imported symbols to pull them from static library */
9#define REF(s) extern void s (); void *____ref_##s = &s;
10
11REF (Py_Main);
12
Andrew MacIntyre41d97d62002-02-17 05:23:30 +000013#include <signal.h>
14
15extern int _CRT_init (void);
16extern void _CRT_term (void);
17extern void __ctordtorInit (void);
18extern void __ctordtorTerm (void);
19
20unsigned long _DLL_InitTerm (unsigned long mod_handle, unsigned long flag)
21{
Andrew MacIntyred65778a2002-12-31 11:23:50 +000022 switch (flag)
23 {
24 case 0:
25 if (_CRT_init ())
26 return 0;
27 __ctordtorInit ();
28
29 /* Ignore fatal signals */
30 signal (SIGSEGV, SIG_IGN);
31 signal (SIGFPE, SIG_IGN);
32
33 return 1;
34
35 case 1:
36 __ctordtorTerm ();
37 _CRT_term ();
38 return 1;
39
40 default:
41 return 0;
42 }
Andrew MacIntyre41d97d62002-02-17 05:23:30 +000043}