{"id":10504,"date":"2015-01-17T13:35:22","date_gmt":"2015-01-17T18:35:22","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=10504"},"modified":"2015-01-17T13:35:22","modified_gmt":"2015-01-17T18:35:22","slug":"skip-the-ffi-embedding-clang-for-c-interoperability","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2015\/01\/17\/skip-the-ffi-embedding-clang-for-c-interoperability\/","title":{"rendered":"Skip the FFI: Embedding Clang for C Interoperability"},"content":{"rendered":"<p><a href=\"http:\/\/llvm.org\/devmtg\/2014-10\/index.html#talk18\">Jordan Rose<\/a>:<\/p>\n<blockquote cite=\"http:\/\/llvm.org\/devmtg\/2014-10\/index.html#talk18\"><p>Most languages that aren&rsquo;t a superset of C provide a Foreign Function Interface (FFI) that allows one to interface with existing C libraries. FFIs are often an afterthought, requiring manual or source-to-source translation from C header files to a subset of the target language, resulting in complicated build processes, frequent manual tweaking, and numerous implementation challenges.<\/p><p>This talk will discuss an alternative approach that embeds Clang into an LLVM-based compiler front end to provide C compatibility without the traditional FFI. Embedding Clang provides seamless access to C APIs, moving the translation of APIs from external tools into the compiler itself. Moreover, one can leverage Clang&rsquo;s deep knowledge of C record layout and calling conventions to simplify the C interface and make both bring up and porting of a new compiler front end simpler.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Jordan Rose: Most languages that aren&rsquo;t a superset of C provide a Foreign Function Interface (FFI) that allows one to interface with existing C libraries. FFIs are often an afterthought, requiring manual or source-to-source translation from C header files to a subset of the target language, resulting in complicated build processes, frequent manual tweaking, and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","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":[45,230,255,229,71],"class_list":["post-10504","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-c","tag-clang","tag-compiler","tag-llvm","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10504","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=10504"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10504\/revisions"}],"predecessor-version":[{"id":10505,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/10504\/revisions\/10505"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=10504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=10504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=10504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}