{"id":8434,"date":"2014-02-12T14:21:12","date_gmt":"2014-02-12T19:21:12","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=8434"},"modified":"2025-07-08T21:53:48","modified_gmt":"2025-07-09T01:53:48","slug":"embedding-resource-files-in-a-cocoa-foundation-command-line-tool","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2014\/02\/12\/embedding-resource-files-in-a-cocoa-foundation-command-line-tool\/","title":{"rendered":"Embedding Resource Files in a Cocoa Foundation Command Line Tool"},"content":{"rendered":"<p><a href=\"http:\/\/mentalfaculty.tumblr.com\/post\/71839659710\/embedding-resource-files-in-a-cocoa-foundation-command\">Drew McCormack<\/a>:<\/p>\n<blockquote cite=\"http:\/\/mentalfaculty.tumblr.com\/post\/71839659710\/embedding-resource-files-in-a-cocoa-foundation-command\"><p><a href=\"https:\/\/twitter.com\/secboffin\">Graham Lee<\/a> 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 <code>xxd<\/code> to convert the file&rsquo;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&rsquo;t investigate using the linker, but <a href=\"https:\/\/twitter.com\/justkwin\">Quinn &ldquo;The Eskimo!&rdquo;<\/a> assures me that you use <code>getsectXXX<\/code> APIs to extract the data at run time. (<strong>Update:<\/strong> Daniel Jalkut has a <a href=\"http:\/\/www.red-sweater.com\/blog\/2083\/the-power-of-plist\">post<\/a> describing this approach.)<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Drew McCormack: 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&rsquo;s data to a C array, and include that directly in your source code. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2025-07-09T01:53:49Z","apple_news_api_id":"e94ee641-2854-43df-8665-8eeec4016282","apple_news_api_modified_at":"2025-07-09T01:53:49Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/A6U7mQShUQ9-GZY7uxAFigg","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[69,75,30,2792,756,71,757],"class_list":["post-8434","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-developertool","tag-mac","tag-mach-o","tag-otool","tag-programming","tag-xxd"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/8434","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=8434"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/8434\/revisions"}],"predecessor-version":[{"id":48406,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/8434\/revisions\/48406"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=8434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=8434"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=8434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}