Link to home
Start Free TrialLog in
Avatar of mskohut
mskohut

asked on

Resources in Static Libraries?

I am using Microsoft Visual C++ 6.0.

How can I include Resources into Static Libraries?
In my case, I want to include String Resources.
What di I have to consider?

Thanks,
Markus
Avatar of NickRepin
NickRepin

There is CVTRES.EXE utility in the "...\Microsoft Visual Studio\VC98\Bin\" directory.

You can use it to convert .RES file to .OBJ file. Then you can include the .OBJ file into the static library .LIB

To compile .RC file into .RES use the standard Microsoft RC.EXE utility, or DevStudio environment.
Nick, have you ever made this work?



CVTRES on a RES produces an OBJ file with the following sections:
 46 .debug$S
 A0 .rsrc$01
300 .rsrc$02

These can be put into a LIB no problem *BUT* when you actually link you get an EXE with no resource directory and no rsrc sections:
E.g.
 6000 .data
 1000 .idata
 2000 .rdata
 1000 .reloc
21000 .text


Any thoughts?


Rob
Futher investigation has convinced me that the linker simply won't accept mulitple resource files or resource data from inside LIB files.

This is why I have allways resorted to encoding the data as plain "C". Then I load it using the CreateXXXXIndirect functions().

Rob
ASKER CERTIFIED SOLUTION
Avatar of NickRepin
NickRepin

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
Avatar of mskohut

ASKER

I think the only way is to supply source .rc code in the static library that I can #include in the resource file of my project which uses the static library.

Has anybody a better solution?

Markus