PDA

View Full Version : DLL problem in DevStudio 2008


Hawkwind
01-15-2008, 04:09 PM
I'm new to DLL coding. I wrote a DLL and an application to use it in Studio 2008 Express edition under Vista, but every instance of the application is loading its own copy of the DLL (!) - at least according to task manager...

Can't figure out why.... this happens whether I run it from DevStudio or
as a standalone.

Help....

Nick
01-15-2008, 10:54 PM
DLLs save disk space, not memory space (*). Every application will load its own instance and link with it.

In 16-bit Windows (prior to 95) DLLs were shared in memory. This caused a lot of problems with static data that was modified by more than one application. 32-bit versions of Windows can handle much more virtual and physical memory, so having separate instances solved the problem.

(*) Actually they can help save memory space. If your engine supports both DirectX and OpenGL, it only has to load one of the renderer implementations.

Reedbeta
01-15-2008, 11:51 PM
Every application will load its own instance and link with it.

Surely code-only sections are still shared in memory, right? It's only the data sections and heap that need to be instanced per process.

.oisyn
01-16-2008, 02:11 AM
Even data can be shared if you put it in a shared data section :)

roel
01-16-2008, 06:24 AM
Surely code-only sections are still shared in memory, right? It's only the data sections and heap that need to be instanced per process.
I remember something similar, but it is ages ago that I was concerned about things like that. Isn't there something like a copy-on-write page flag?

Hawkwind
01-16-2008, 10:02 AM
Surely there must be a way to make the DLL shared ? - I thought that was the whole idea, otherwise what would be the point of writing re-entrant code in a DLL ?