windres - Native resources?

nick clifton
Tue Nov 27 17:45:00 GMT 2012

Hi Jean-Claude,

   Sorry for taking so long to reply to your email.

> [  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.

That is because the symbol names inside programs cannot start with a 
period, and even if you leave that off, the compiler automatically 
prepends an underscore to the symbol name.  The trick however, assuming 
that you are using gcc, is to use an asm directive, as in:

   extern int rsrc asm (".rsrc");

> 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?

Try --input-format

 > What are the possible values?

These should be listed in the output of "windres --help".


More information about the Binutils mailing list