/[eiffelstudio]/trunk/Delivery/studio/config/windows/templates/egc_dynlib.template
ViewVC logotype

Contents of /trunk/Delivery/studio/config/windows/templates/egc_dynlib.template

Parent Directory Parent Directory | Revision Log Revision Log


Revision 60693 - (show annotations)
Wed Jun 28 04:21:38 2006 UTC (13 years, 7 months ago) by manus
File size: 977 byte(s)
Made it work when DLL is compiled in multithreaded mode. Basically, the runtime
  is initialized once during the DLL_PROCESS_ATTACH, then destroyed in DLL_PROCESS_DETACH.
  For each thread creation, we initialize the once per thread data like it is done
  in `eif_thr_entry'. This solves problem with bug#10224.

1 /********************
2 *** EGC_DYNLIB.C ***
3 ********************/
4
5 #include "egc_dynlib.h"
6 #include "eif_sig.h"
7
8 RT_LNK HANDLE ghInstance;
9 RT_LNK HINSTANCE eif_hInstance;
10 RT_LNK HINSTANCE eif_hPrevInstance;
11
12 extern void egc_init_plug();
13
14 void init_rt (void)
15 {
16 #ifdef EIF_THREADS
17 eif_thr_register();
18 initsig();
19 initstk();
20 #endif
21 }
22
23 BOOL WINAPI DllMain (HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpvReserved)
24 {
25 switch (ul_reason_for_call) {
26 case DLL_PROCESS_ATTACH:
27 ghInstance = hInst;
28 eif_hInstance = hInst;
29 eif_hPrevInstance = hInst;
30 {
31 int argc = 1;
32 char *argv[] = {"",""};
33
34 eif_alloc_init();
35 eif_thr_init_root ();
36 {
37 GTCX;
38 egc_init_plug();
39 initsig();
40 initstk();
41 eif_rtinit(argc, argv, (char **)0);
42 }
43 }
44 break;
45 case DLL_PROCESS_DETACH:
46 reclaim ();
47 break;
48 case DLL_THREAD_ATTACH:
49 init_rt();
50 break;
51 case DLL_THREAD_DETACH:
52 eif_thr_exit();
53 break;
54 }
55 return TRUE;
56 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23