News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Resources in static libs

Started by gabor, March 23, 2007, 10:08:03 AM

Previous topic - Next topic

gabor

Hi!

My question is very simple: is it possible to put resources (dialogs, icons, bitmaps, strings...) into static libs.
I tried to do this:
LIB.EXE static.obj rscr.obj
like it is done for creating executables:
LINK.EXE test.obj rscr.obj
I'm afraid it is not possible to store resources, the dialogs I put into rscr.obj were not available in the exe that was the static lib linked into.
(Upon DialogBoxParam call trhe system returns the "resource not found in image file" error.)
If this is true and resources cannot be stored this way, could anyone recommend a work around for delivering dialogs or string with a lib (without using dlls).
I might put those resources into the data section and create dialogs via DialogBoxIndirectParam, but this should be the last I try.

Greets, Gábor

Vortex

Hello Gabor,

Me too, I tried to create static libraries from res files converted with cvtres.exe to obj but it didn't work. My solution is to extract binary templates from compiled resource files and encapsulate the binary data in object files. I do the conversion with the res2obj tool. The resource templates are presented to the linker with labels :

res2obj ColorDlg.res Rsrc1.obj _ColorDlg
res2obj Listbox.res Rsrc2.obj _Listbox
\masm32\bin\link -lib /OUT:Rsrc.lib *.obj


Building a project is easy :

\masm32\bin\ml /c /coff ColorDlg.asm
\masm32\bin\polink /SUBSYSTEM:WINDOWS ColorDlg.obj ..\Reslib\Rsrc.lib

[attachment deleted by admin]

gabor

Hi Vortex!

This is perfect! Thanks a lot for the precise answer and solution!

Greets, Gábor