I've turned a couple of resource files into .obj files using objcopy
and i link them with my programs source code.
I can very well access the symbols inside the object file in my program with the following code, but only with GCC/G++ (Cygwin):
extern uint8_t data[] asm("_binary_Resources_0_png_start");
extern uint8_t size[] asm("_binary_Resources_0_png_size");
extern uint8_t end[] asm("_binary_Resources_0_png_end");
The code doesn't work in Visual Studio, probably because VS has it's own __asm
command.
I want to include my programs resources (Images, Shaders, etc.) in my final executable's .data
section through linking them.
But how can i access the symbols defined in the object file in VC++?
I tried extern uint8_t _binary_Resources_0_png_start[]
or extern "C" uint8_t _binary_Resources_0_png_start[]
without the assembly command, but i get unresolved symbol link errors.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…