1. Computing & Technology

Discuss in my forum

Zarko Gajic

Use DLL from Resources (RES) Without Storing It On The File System First

By , About.com GuideNovember 7, 2011

Follow me on:

in Resources and DLLs ::

The article how to store a DLL inside a Delphi program exe file as a resource explains how to ship a DLL with your Delphi application executable file as a resource.

Recently, I've received an email from Mark E. Moss, asking if a DLL stored in a RES can be used without first saving it on the file system (hard disk)? My initial answer was "to use a DLL stored inside a Delphi application executable file, the DLL first needs to be stored on the file system". I was wrong :)

Read the full article to learn how to Load a DLL From a Resource Directly From Memory in Delphi Applications.

NOTE: Soon after publishing this article I've received an email from Jason Penny:
The linked BTMemoryModule.pas does not work with Delphi 2009 (and I would assume Delphi 2010 also).
I found a similar version of the BTMemoryModule.pas file a while ago, and made changes so it works with (at least) Delphi 2006, 2007 and 2009. My updated BTMemoryModule.pas, and a sample project, are at BTMemoryLoadLibary for Delphi >= 2009"

Related:

Comments
January 19, 2010 at 11:58 am
(1) Michael Rockett says:

This is quite interesting – certainly will give it a go.

Thanks for the post Zarko. :)

January 20, 2010 at 9:58 pm
(2) dEE says:

You’re great, ma men…

November 9, 2011 at 12:51 pm
(3) Dagan Hoover says:

I would also like to point out that if your program has any dependencies with Visual C libraries (like MSVCP80.dll) it will not load. You can find out more information here: http://msdn.microsoft.com/en-us/library/ms235624(VS.80).aspx

Now a short workaround is to recursively load with BT each dependency as well as the main dll. But you’ll end up with a big mess.

However, if you have a DLL that you created that uses the standard libraries (Kernel32, User32, etc) then BT works great.

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>
Related Searches lunes noviembre first monday

©2012 About.com. All rights reserved.

A part of The New York Times Company.