:How can I bundle a text/gif file in the shared object. Basically I want
:to read the content of this text file but I cannot have it seperately
n the disc.
C doesn't know what "shared objects" are, but fortunately for you
that part of your question is irrelevant.
Just write a piece of code that reads the object and generates
from that a C source file containing the data in a usable form.
You could do something simple like having the interface be
extern unsigned char the_shared_file[];
extern size_t size_of_the_shared_file[];
or you could go fancier with making the object static (and
thus visible only in the defining file) and providing accessor
routines, possibly even providing an fread_shared_object routine
that mimics fread() in calling parameters.
To generate the necessary C file, the utility C file would read
the entire file into memory, keeping track of how big it was,
and then could write it out even by something as crude as
printf( "size_t size_of_the_shared_file = %lu\n",
(unsigned long) size_of_object );
printf( "unsigned char the_shared_file[] = {\n" );
for (object_index = 0; object_index < size_of_object; object_index++)
printf( "0x%02x,\n", input_object[object_index] );
printf( "};\n" );
It doesn't matter whether you only output one byte per line or
if you pack the bytes into neat rows of 16 or so -- only the
compiler has to look at the generated file once you've debugged the
generating logic.