Link to home
Start Free TrialLog in
Avatar of DaveHope
DaveHope

asked on

Embed DLL in .res (windres)

I'm keen to share a substantial amount of code between two of my applications. The best way to do this is for me to create a DLL (which I've done) and make both apps use the DLL.

Rather than ship two files to the user (exe and dll) I want to embed the DLL as a resource inside the EXE.

From what I understand, this should be easy. In my header I have:

#define IDR_PKEY_DLL 102

Then, in my .res file I have:

IDR_PKEY_DLL BINARY MOVEABLE PURE res\\Project.dll

However, Windres fails with:

compiling: resource.rc
windres.exe: resource.rc:17: syntax error
Avatar of jkr
jkr
Flag of Germany image

Shouldn't that just be

IDR_PKEY_DLL BINARY "res\\Project.dll"

?

"MOVEABLE" and "PURE" aren't valid resource compiler statements...
take a look at

http://www.cs.fsu.edu/~baker/ada/gnat/html/gnat_ugn_31.html

particularly the section on "Compiling Resources"
does it compile if you use rc??
Avatar of DaveHope
DaveHope

ASKER

trinitrotoluene:

My resource compiles and works fine with the ICON, VERSIONINFO and DIALOGEX stuff so I'm fairly sure it's not a problem with the way I'm using my resource.

jkr::

I'll give that a go and see how that goes and update you. However, I thought that they were used for the following:

MOVEABLE - Compiled Resources can be moved to compact memory
PURE - No custom resource

They could however be depreciated, so I'll give it a go.

Cheers!

Hi,

Just removed MOVEABLE and PURE with the same problem.

I also renamed the "res" folder to "resource" as there was a bug in a previous version of windres version which didn't like using a folder called "res".

RC now reads:

IDR_PKEY_DLL BINARY resource\\Project.dll

Thanks,

Dave
DaveHope: since you are embedding the dll inside the exe why don't you create a static .lib and build your application. This seems more straightforward to me.....

jkr: your comments on this please....
ASKER CERTIFIED SOLUTION
Avatar of DaveHope
DaveHope

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial