windres - Native resources?

Jean-Claude Gervais jc.gervais@videotron.ca
Thu Nov 8 20:08:00 GMT 2012


Hello,

I'm new to using the binutils. So far, by observing successful outputs
I've come to the conclusion that the way that windres works (in the case
of MinGW) is the following:

windres compiles the resource script and then packs the compiled
resources into a native (for MinGW) object file, that object file gets
linked into the applications and the applications calls Windows API
functions that somehow localize the resource in memory and read it.

The preceding behaviour is derived from a command such as
windres --target=pe-i386 -i resource.rc -o resource.o

This yields an object file that I can pass to objdump:

objdump -t -b pe-i386 resource.o

resource.o:     file format pe-i386

SYMBOL TABLE:
[  0](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 0) 0x00000000 .rsrc

Apparently (I may be wrong, please feel free to correct me) the object
file contains one symbol called .rsrc that the Windows API functions
must somehow locate and use to find the resources.

What I would like to do is access the .rsrc symbol directly, in plain c
code.

How can I obtain a pointer to the symbol? The compiler doesn't seem to
be able to find the symbol if I declare an extern char called rsrc. 

Is there a way to access the symbol directly from C?

The reason I ask is because I would like to embed resources inside a
native application.

For example, I tried the following command:

windres --target=elf64-ia64-little -i resource.rc -o resource.o

But windres complains about not being able to detect the architecture.
How do I tell it the architecture type? What are the possible values?

I am trying to build a native resource object for (uname output):

Linux 3.2.12-gentoo #6 SMP x86_64 Intel(R) Core(TM)2 Quad CPU Q6600 @
2.40GHz GenuineIntel GNU/Linux

How do I form the proper command line so windres will output an object
native to this platform?

Thank you for taking the time to read this.
J



More information about the Binutils mailing list