Changes between Initial Version and Version 1 of Ticket #19, comment 11


Ignore:
Timestamp:
Oct 20, 2011, 1:20:43 PM (13 years ago)
Author:
dmik
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #19, comment 11

    initial v1  
    1 Regardin _DLL_InitTerm() and exit lists. AFAIU, the whole matter of using exit lists in Odin is because the OS/2 loader has a substantial bug: the order in which DLLs are loaded (and _DLL_InitTerm(0) used to initialize DLL data is called) doesn't necessarily match the order in which they are unloaded (and _DLL_InitTerm(1) is called to perform the cleanup). As a result, if dll-B uses something from dll-A in its cleanup procedure (_DLL_InitTerm(1)) and dll-A gets unloaded before dll-B, a crash will occur.
     1Regarding _DLL_InitTerm() and exit lists (I've just come to that point). AFAIU, the whole matter of using exit lists in Odin is because the OS/2 loader has a substantial bug: the order in which DLLs are loaded (and _DLL_InitTerm(0) used to initialize DLL data is called) doesn't necessarily match the order in which they are unloaded (and _DLL_InitTerm(1) is called to perform the cleanup). As a result, if dll-B uses something from dll-A in its cleanup procedure (_DLL_InitTerm(1)) and dll-A gets unloaded before dll-B, a crash will occur.
    22
    33The solution (advertised even in VAC++ Programming Guide!) is to use exit lists. Exit lists are guaranteed to be processed before any DLL gets unloaded at process termination which solves the cleanup order issue (given that the proper exit list order codes that ensure the specific order are used).