Solved

Resources in Static Libraries?

Posted on 2001-07-31
5
1,231 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
  • 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 100 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

863 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now