Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can use ld to turn any file into an object file:

    ld -r -b binary -o foo_txt.o foo.txt
foo_txt.o then has these symbols:

extern const char _binary_foo_txt_start[]; extern const char _binary_foo_txt_end[]; extern const void *_binary_foo_txt_size;

So you need to write your own declarations (it doesn't generate a header file).

_binary_foo_txt_size is weird and has to be used as: (size_t)&_binary_foo_txt_size

Or use (size_t)(_binary_foo_txt_end - _binary_foo_txt_start) instead.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: