Dll boot order

If I have a global variable in A.dll that depends on a global variable in B.dll, is loading of B.dll before A.dll guaranteed? I created two sample dll projects in Visual Studio and linked A.dll to B.dll, and it seems that B.dll is loading first. So is this behavior ensured?

+1
dll visual-c ++ winapi
source share
1 answer

This behavior is guaranteed by the operating system, because otherwise it would be impossible to write the correct dll-loading code. In particular, if A.dll imports B.dll , then when the dynamic linker tries to load A.dll , it will first see this dependency and the load of B.dll .

+6
source share

All Articles