I am trying to insert binary drops in an exe file. I am using mingw gcc.
I am making an object file as follows:
ld -r -b binary -o binary.o input.txt
Then I look at the output of objdump to get the characters:
objdump -x binary.o
And he gives the characters with the name:
_binary_input_txt_start _binary_input_txt_end _binary_input_txt_size
Then I will try to access them in my C program:
#include <stdlib.h> #include <stdio.h> extern char _binary_input_txt_start[]; int main (int argc, char *argv[]) { char *p; p = _binary_input_txt_start; return 0; }
Then I compile like this:
gcc -o test.exe test.c binary.o
But I always get:
undefined reference to _binary_input_txt_start
Does anyone know what I'm doing wrong?
c gcc binary mingw
myforwik Apr 13 '10 at 4:38
source share