?
Solved

Resources in Static Libraries?

Posted on 2001-07-31
5
Medium Priority
?
1,252 Views
Last Modified: 2013-12-03
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
0
Comment
Question by:mskohut
[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
  • 2
  • 2
5 Comments
 
LVL 15

Expert Comment

by:NickRepin
ID: 6338461
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.
0
 
LVL 5

Expert Comment

by:robpitt
ID: 6340122
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
0
 
LVL 5

Expert Comment

by:robpitt
ID: 6340180
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
0
 
LVL 15

Accepted Solution

by:
NickRepin earned 300 total points
ID: 6342624
>>Nick, have you ever made this work?

No, that's why it is only a comment

>>when you actually link you get an EXE with no resource
directory and no rsrc sections

The stupid MS linker has no option to force the linking of a certain obj from a library. Unfortunately, an obj from res does not contain any external symbols, and /INCLUDE option cannot be used.

>>the linker simply won't accept mulitple resource files

It's true, the twice stupid MS linker cannot use several .res files.


Well, you can use only one obj file with resources inside. You have to use this obj separately, of before the linking you have to extract this obj from the lib.
0
 

Author Comment

by:mskohut
ID: 6360025
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
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

770 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