Changeset 439
- Timestamp:
- Jul 25, 2003, 3:37:21 PM (22 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/lib/startup/dllinit.c
-
Property cvs2svn:cvs-rev
changed from
1.5
to1.6
r438 r439 1 /* This is the startup code for gcc.dll (and can be used as well for any other 2 DLL which uses exceptions). It should call __ehInit() as any other dynamic 3 library which uses exceptions, otherwise the C++ programs linked to it will 4 fail to catch exceptions. 5 6 -= This is duplicated in libgcc and this copy must be removed when =- 7 -= we've done a new release! =- 8 9 */ 10 1 /* */ 2 #include <emx/startup.h> 11 3 extern int _CRT_init (void); 12 4 extern void __ctordtorInit (void); 13 5 extern void __ctordtorTerm (void); 14 extern void __ehInit (void); 15 extern void __ehTerm (void); 6 extern void __ehInitDLL (void); 7 #pragma weak __ehInitDLL 8 extern void __ehTermDLL (void); 9 #pragma weak __ehTermDLL 16 10 17 unsigned long _System _DLL_InitTerm (unsigned long mod_handle, unsigned long flag) 11 /** 12 * This is the typical DLL startup code. __ehInitDLL and __ehTermDLL is called 13 * are for exception handler stuff in gcc, the two functions will be linked if 14 * there is exception handler info in the module. (Btw. if these calls wasn't 15 * made we would fail to catch exceptions in C++ code.) 16 * @returns 1 on success. 17 * @returns 0 on failure. 18 * @param hmod Handle of this DLL. 19 * @param flag 0 init. 20 * 1 term. 21 * @remark This function is called from dll0.asm. 22 */ 23 unsigned _System _DLL_InitTerm (unsigned hmod, unsigned flag) 18 24 { 19 25 switch (flag) … … 21 27 case 0: 22 28 if (_CRT_init () != 0) 23 return 0; 29 break; 30 if (__ehInitDLL) 31 __ehInitDLL (); 24 32 __ctordtorInit (); 25 __ehInit ();26 33 return 1; 27 34 case 1: 28 __ehTerm ();29 35 __ctordtorTerm (); 36 if (__ehTermDLL) 37 __ehTermDLL (); 30 38 return 1; 31 default:32 return 0;33 39 } 40 return 0; 34 41 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/gcc/gcc/config/i386/emx-dllinit.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r438 r439 2 2 DLL which uses exceptions). It should call __ehInit() as any other dynamic 3 3 library which uses exceptions, otherwise the C++ programs linked to it will 4 fail to catch exceptions. */ 4 fail to catch exceptions. 5 6 -= This is duplicated in libgcc and this copy must be removed when =- 7 -= we've done a new release! =- 8 9 */ 5 10 6 11 extern int _CRT_init (void); 7 12 extern void __ctordtorInit (void); 8 13 extern void __ctordtorTerm (void); 9 extern void __ehInit (void); 10 extern void __ehTerm (void); 14 extern void __ehInitDLL (void); 15 #pragma weak __ehInitDLL 16 extern void __ehTermDLL (void); 17 #pragma weak __ehTermDLL 11 18 12 19 unsigned long _System _DLL_InitTerm (unsigned long mod_handle, unsigned long flag) … … 16 23 case 0: 17 24 if (_CRT_init () != 0) 18 return 0; 25 break; 26 if (__ehInitDLL) 27 __ehInitDLL (); 19 28 __ctordtorInit (); 20 __ehInit ();21 29 return 1; 22 30 case 1: 23 __ehTerm ();24 31 __ctordtorTerm (); 32 if (__ehTermDLL) 33 __ehTermDLL (); 25 34 return 1; 26 default:27 return 0;28 35 } 36 return 0; 29 37 } -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/gcc/gcc/config/i386/emx-eh.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r438 r439 6 6 extern void __register_frame_table (void *begin); 7 7 extern void __deregister_frame (void *begin); 8 9 /** Exception handler stuff init indicator. 0 means not inited, 1 means inited. */ 10 static int inited; 8 11 extern void __ehInit (void); 9 12 extern void __ehTerm (void); 13 extern void __ehTermDLL (void); 10 14 11 void __ehTerm (void) 15 /** 16 * Inits exception handler stuff. 17 * Intended external caller is _DLL_InitTerm. 18 */ 19 void __ehInitDLL (void) 12 20 { 13 static int done; 14 15 if (!done) 21 if (!inited) 16 22 { 17 23 int *ptr = &__eh_frame__; 18 done = 1; 24 inited = 1; 25 __register_frame_table (&ptr [*ptr == -2 ? 1 : 2]); 26 } 27 } 28 29 /** 30 * Terminates exception handler stuff. 31 * Intended external caller is _DLL_InitTerm. 32 */ 33 void __ehTermDLL (void) 34 { 35 if (inited) 36 { 37 int *ptr = &__eh_frame__; 38 inited = 0; 19 39 __deregister_frame (&ptr [*ptr == -2 ? 1 : 2]); 20 40 } 21 41 } 22 42 43 44 /** 45 * atexit() procedure used pto terminate exception stuff in programs. 46 * Registered by __ehInit. 47 */ 48 static void __ehTerm (void) 49 { 50 __ehTermDLL(); 51 } 52 53 /** 54 * Init exception handler stuff for a program. 55 * Intended external caller is GCC generated main() code. 56 */ 23 57 void __ehInit (void) 24 58 { 25 static int done; 26 27 if (!done) 59 if (!inited) 28 60 { 29 int *ptr = &__eh_frame__;30 done = 1;31 __register_frame_table (&ptr [*ptr == -2 ? 1 : 2]);32 61 atexit (__ehTerm); 62 __ehInitDLL(); 33 63 } 34 64 } 65 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.