I want to link in raw binary data. I\'d like to either put it at a particular address, or have it link to a symbol (char* mydata, for instance) I have defined in code. Sinc
Another approach might be to use xxd.
xxd -i your_data your_data.c
In the file you'll get two symbols unsigned char your_data[]
and unsigned int your_data_len
. First one will be a huge array containing your data, second one will be the lenght of that array.
Compilation of created C file might be time taking, so if you are using a build system / Makefile handle it properly avoiding unnecessary recompilations.
xxd
should be part of vim
(vim-common
) package for your Linux distribution.