Solved

Embed DLL in .res (windres)

Posted on 2009-04-06
7
1,043 Views
Last Modified: 2012-08-13
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
0
Comment
Question by:DaveHope
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 24078283
Shouldn't that just be

IDR_PKEY_DLL BINARY "res\\Project.dll"

?

"MOVEABLE" and "PURE" aren't valid resource compiler statements...
0
 
LVL 12

Expert Comment

by:trinitrotoluene
ID: 24080248
take a look at

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

particularly the section on "Compiling Resources"
0
 
LVL 12

Expert Comment

by:trinitrotoluene
ID: 24080292
does it compile if you use rc??
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:DaveHope
ID: 24084410
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!

0
 

Author Comment

by:DaveHope
ID: 24084424
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
0
 
LVL 12

Expert Comment

by:trinitrotoluene
ID: 24095550
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....
0
 

Accepted Solution

by:
DaveHope earned 0 total points
ID: 24114089
Solved.

Using the correct quotes solved the problem.

Thanks anyway.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question