Jump to content


DLL problem in DevStudio 2008


5 replies to this topic

#1 Hawkwind

    Member

  • Members
  • PipPip
  • 92 posts

Posted 16 January 2008 - 12:09 AM

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....

#2 Nick

    Senior Member

  • Members
  • PipPipPipPip
  • 1225 posts

Posted 16 January 2008 - 06:54 AM

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.

#3 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 16 January 2008 - 07:51 AM

Nick said:

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#4 .oisyn

    DevMaster Staff

  • Moderators
  • 1822 posts

Posted 16 January 2008 - 10:11 AM

Even data can be shared if you put it in a shared data section B)
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#5 roel

    Senior Member

  • Members
  • PipPipPipPip
  • 698 posts

Posted 16 January 2008 - 02:24 PM

Reedbeta said:

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?

#6 Hawkwind

    Member

  • Members
  • PipPip
  • 92 posts

Posted 16 January 2008 - 06:02 PM

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 ?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users