Re: Resources in a static library



Torsten Hensel wrote:
Hi!

I've created a static library that contains a dialog class. The dialog is created using the dialog editor, so it's described in a resource file. However, static libraries cannot contain resources.

You are wrong. Static libraries can very well contain resources. It's just the resource editor that cannot cope easily with distributed resource IDs.

> So the application using
the lib needs to include the resources. When I add a resource include I must include the resource.h, but this may lead to resource ID clashes. I could copy the resources from the library project to the application project, but this is not what I want. Creating a DLL is no option either.

Is there any way that I can create a static library that contains a dialog and link to this library without any additional steps? Perhaps there is a way to create C++ code from the resource file so that the dialog is created "manually" instead of using resources...

Just add a resource file to your static library. The build step will compile all ..rc files that are part of the project with the resource compiler. Keep in mind that the resource compiler generates plain .obj/.res files which can be linked just like code object files.

Regards,
Stuart
.



Relevant Pages

  • Re: How to add to the resource a full text (not just one line)?
    ... The resource editor I use allows to insert one line of text ... Also, my resource file already contains some wave files, bitmaps and ... Special Characters or Escape Sequences for this purpose. ...
    (microsoft.public.vb.general.discussion)
  • Re: VS2005 wont edit my .RC files
    ... > It appears something corrupted in your resource file, ... > editor cannot recognize the preprocessor definition. ... > then add it back in via the resource editor as you mentioned above. ...
    (microsoft.public.vsnet.general)
  • Re: CDialog in static library
    ... > DIALOG resource is not being added to the *.exe. ... Static libraries do not ... "staticlib.rc" say, available in my static library project, and I would like ... to somehow include it in the client project. ...
    (microsoft.public.vc.mfc)
  • Re: XP icons
    ... When I add it to the resource, the editor only shows the 256 colour one.I ... want the apps window to show the 32bit icon in XP. ... >> bit) to the resource file. ...
    (microsoft.public.vc.language)
  • Ann: Resource Builder 2.3.3!
    ... SiComponents Team would like to notify you about the Resource Builder ... powerful and fast resource file editor? ... Resource Builder - very useful full-featured resource editor for Windows ...
    (borland.public.delphi.thirdpartytools.general)