Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 13540, How to create a DLL from a resource

by Alex Bakaev Email: Anonymous


Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For C++Builder, Version 1.0  to 4.0 2416 downloads
Copyright: No significant restrictions


Size: 2,600 bytes
Updated on Thu, 16 Sep 1999 00:00:00 GMT
Originally uploaded on Thu, 16 Sep 1999 00:00:00 GMT
SHA1 Hash: 51DDF053B32E2F6686916B53BDDDB9F29FCB57F4
MD5 Hash: 9DF4BEA6371704332BA60E4D7D89335C

    Explore the files in this upload

Description
This code sample shows how to create a DLL from binary data stored in an .exe resources.
Also, it shows a small bit on using STL.

The .rc file has to be setup something like this:

MYDLL DLL MyDll.dll

Here is an example of instantiating and calling a function in a DLL created from a resource.

alexb::TDllResource tmp = alexb::TDllResource::CreateDLL( HInstance, _T( "MYDLL" ) );
alexb::stdcallTDllProc5 tmp1( HInstance, _T( "MYDLL" ) );
tmp1( "FuncWith_5_Params", "", 1, 1, "", 1 );

If you need different functions ( different as in different number of parameters ), all you do is add more member template functions, using existing ones as an example.

Please, send all/any bugs to alexb@jetsuite.com

P.S. Originally I indended to delete the DLL file. But, alas, Windows doesn't let me. It keeps the .DLL file locked, event after FreeLibrary. So I changed the code a bit to check if the file exists already. It would be nicer if I could delete the file, but some may say it's better this way. If you find a way to delete a just unloaded DLL, drop me a line.

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC03