Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22072

Embedding binary blobs using gcc mingw

$
0
0

I am trying to embed binary blobs into an exe file. I am using mingw gcc.

I make the object file like this:

ld -r -b binary -o binary.o input.txt

I then look objdump output to get the symbols:

objdump -x binary.o

And it gives symbols named:

_binary_input_txt_start_binary_input_txt_end_binary_input_txt_size

I then try and 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 am doing wrong?


Viewing all articles
Browse latest Browse all 22072

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>