I'm designing some cross platform tool, and I want to store some read only data, kind of resource data like:
- Program icon
- Images
- Strings
- "Manufacturated by ..." info
- File version info
I'm trying to code the tool, either "pure c" or "c++".
I want to store the resource data using assembler, therefore, the data could be read in two ways:
(1) The program or shared library itselfs read its data, as a variable or assembler data section.
(2) The executable file or shared library file could be read by other program without been running or loaded.
The data will be only write once, when the code is compiled.
I found 2 possible ways to do this.
(1) Inline assembly. Add asm instructions, directly, to the "pure c" or "c++" files, several compilers, like Borland, MS, GNU, had some form of this.
(2) Generate the code and the assembly code in separate files, and, use a compiler tool, such a linker, build, or compiler, to compile togheter all.
I don't want to store assembler instructions, only data.
I'm targeting x86-32 bits processors, Windows, Linux & BSD, but, can be extended to other platforms or architectures, if possible.
I'm aware that Windows & Linux use different file formats such as PE or COFF or ELF binaries.
Any additional or alternative ideas ? Any suggestions, manuals, links on how to do this ?
Thanks.