need some advice...
-
Hi guys, I ve got a question, a stupid question maybe... I m making a DLL, with oviously heaps of functions in it. I would like to have a static variable (something that could be modified my some functions). I was wondering if there is nothing dodgy in creating a static variable in a DLL. Since, I dunno how and when exactly the DLL is loaded and unloaded. Is it reloaded each time a function gets called? It s a bit fuzzy to me. Maybe there is nothing special in this but I just wanted to be sure.. Thank u 4 ur help... sysy
-
Hi guys, I ve got a question, a stupid question maybe... I m making a DLL, with oviously heaps of functions in it. I would like to have a static variable (something that could be modified my some functions). I was wondering if there is nothing dodgy in creating a static variable in a DLL. Since, I dunno how and when exactly the DLL is loaded and unloaded. Is it reloaded each time a function gets called? It s a bit fuzzy to me. Maybe there is nothing special in this but I just wanted to be sure.. Thank u 4 ur help... sysy
There are ways a DLL can be loaded. 1/ Implicitly. This is the usual way. It happens if you link to the DLL when you are creating your EXE. When the DLL is loaded, the DllMain function is called, and static variables in that module (DLL) are initialed. This happens once for each process. See DllMain for more detail. 2/ Explicitly. This happens at runtime, by the SDK function LoadLibrary. There are articles on codeproject about DLLs for beginners. I would recommend looking there. Iain.