2 ms·
Are there any advantages vs just embedding the file as a char array? I've found it easier to mmap any input files anyway so as to avoid an extra level of buffer
by anilakar 8y ago
Are there any advantages vs just embedding the file as a char array? I've found it easier to mmap any input files anyway so as to avoid an extra level of buffering in userspace.
- jschwartzi 8y agoIf you don't have a userspace or a filesystem, you can't memory map anything from it. In that case, your binary needs to contain all of the assets it needs to run such as images. I've needed to do this to embed images in an application written on bare metal before. objcopy and its ilk do turn the data into a byte array that has a symbol in the symbol table. You then reference that symbol in your code. Generally you're not embedding this stuff in an ELF in that case.