Skip to main content
GameDev.net gamedev.net
🔒 Locked

DLL problems

Started by MENTAL Sep 23, 2000 at 9:17 AM 0 replies 250+ views
Original Post
MENTAL
MENTAL
Okay, i have a dll calls MyDll.dll and 2 programs, MyProg1.exe and MyProg2.exe. both the programs are being run at the same time, and both need to use the lib. now, in MyDll.dll there''s an internal int called "int MyVar;", an exported function called "void SetVar(int Value)" and another exp. function called "int GetVar()". Now, when each program calls LoadLibrary, will they get their own "copy" of the DLL, or will it be made global (so they share it)? In other words, does each program get their own MyVar or do they have to share it, meaning it could be changed without the other program knowing about it?? Any help appreciated MENTAL
Topgoro
Topgoro
Hello.

No, as I understand, each DLL loaded is mapped to the address space of the process loading it. Becasue of this, the variable in the DLL catains a value for each of the the processes that has nothing to do with the value of the other process.

About how many times a DLL is loaded to memory when more than one process uses it, I think all processes share the same copy, they just use diferent data segment locations.

Topgoro


We emphasize "gotoless" programming in this company, so constructs like "goto hell" are strictly forbidden.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.