Graham Lee and several others pointed me to two standard solutions: you can use the linker to embed the files in the __text section of the Mach-O binary, or you can use a tool called
xxd
to convert the file’s data to a C array, and include that directly in your source code. I ended up with the second solution, which I will explain further below. I didn’t investigate using the linker, but Quinn “The Eskimo!” assures me that you usegetsectXXX
APIs to extract the data at run time. (Update: Daniel Jalkut has a post describing this approach.)
↧
Embedding Resource Files in a Cocoa Foundation Command Line Tool
↧