[DUG] LoadLibrary from resource?

Trevor Jones trevorj at ihug.co.nz
Tue Mar 14 16:43:57 NZDT 2006


Paul,

  No you can't do this.  It is a limitation imposed by the OS.

 

  When you call LoadLibrary, the OS maps the disk file that contains the dll
into the process memory space.  It doesn't necessarily load it into memory.
When you try to access anything in the library ( the first time), it will
generate a page fault and the OS will actually allocate RAM and really load
the library (or parts thereof) into RAM.

 

  Effectively you have a memory to file mapping, and for that to work, the
file must exist.

 

  It kinda sucks, but that is the way that Windows works.

 

Trevor

 

  _____  

From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz] On
Behalf Of Paul A Norman
Sent: Tuesday, 14 March 2006 4:30 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: [DUG] LoadLibrary from resource?

 

Hi all,

 

Is it possible to store a DLL in a RES and access it for loadLibrary()
purposes, as a stream or something without having to save it to disk and
access as per normal?

 

Paul

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns3.123.co.nz/pipermail/delphi/attachments/20060314/03576402/attachment.html


More information about the Delphi mailing list