开发者

Dll loading order

开发者 https://www.devze.com 2022-12-22 03:06 出处:网络
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开发者_StackOverflo

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消