Scenario:
My Application bind a library X which has static class. I initialize it in my process. After some time when I load a dll which also use same library X.
I see content of static variable in dll is not initialized. Where I already initialized it in process before loading DLL.
I added initialization code in DLL main , and its working now.
Question : I need to und开发者_如何学JAVAerstand this behavior / case.
library x is clearly linked as a static library against both the exe, and the dll :- in order to get the behavior you want, library X itself needs to be built as a shared library. So then "my application.exe" and "a.dll" would both use "libraryx.dll" as a result there would only by one instance of the static value.
精彩评论