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 Studio, and link A.dll with B.dll , and it seems, that B.dll is loaded first.So is this behavior guaranteed ?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.