Solved

Resources in Static Libraries?

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

691 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