Dll loading order
If i have global variable in A.dll, that depends on global variable in B.dll , is it guaranteed that B.dll will be loaded before A.dll? I made two sample dll projects in Visual Stud开发者_StackOverflow社区io, and link A.dll with B.dll , and it seems, that B.dll is loaded first.So is this behavior guaranteed ?
This behavior is guaranteed by the OS, because otherwise it would be impossible to write proper dll-loading code. In particular, if A.dll
imports B.dll
, then when the dynamic linker attempts to load A.dll
, it will see that dependency and load B.dll
into the process first.
精彩评论