Executable loads same dll as already loaded dll

依然范特西╮ 提交于 2019-12-11 02:55:40

问题


I'm about to start making major modification to my project and I just want to clarify something as I think my design maybe somewhat complicated.

I have an executable that loads a dll, lets call this dll1, this then loads dll2. The executable also loads dll2.

What I'm asking is do I have two instances of dll2's global and static member variables, does the second load of dll2 happen or can an execuable only ever load 1 of dll2 even if dll2 was loaded by a different dll?

I know I should only have one copy of dll2's code in memory this is fine. It is the global and static variables I'm interested in.


回答1:


You can only have one instance of any particular DLL loaded per process.




回答2:


You can of course load different instances of the same DLL, this is practice is not common, but it is technically possible. Have a try with Process Explorer. See the snapshot below.



来源:https://stackoverflow.com/questions/21364573/executable-loads-same-dll-as-already-loaded-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!