Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Quickly Create Mono Bindings with Objective Sharpie

Quickly Create Mono Bindings with Objective Sharpie

This item in japanese

Objective Sharpie is the child of Aaron Bockover. This tool creates C# bindings suitable for use in Mono for Objective C SDKs.

Objective Sharpie works by using Clang to parse Objective C header files. Since the process is automated, and has full access to the header, binding errors should be non-existent for most libraries.

Aaron created Objective Sharpie in order to deal with the tedious task of creating bindings for OS X Lion and Mountain Lion. According to Aaron, OS X Lion “thousands of new APIs”. He continues,

This fear of monotony fueled me to implement a tool that used Clang as a library to gain access to every single detail of the source tree as it’s parsed. With this information, I was able to start generating C# code that represented a verifiably correct binding.

It’s important to note that we build Xamarin.Mac and Xamarin.iOS using the exact same binding tools that are available in Xamarin Studio to bind third party libraries. And now Objective Sharpie is no different: it helps us deliver faster on new APIs and ensure that they are accurate and error-free by producing a correct binding definition up front.

It is important to note that this is a work in progress. While most common language features are covered, the code generator doesn’t support the entire Objective C language. It also doesn’t correct naming conventions, so you may wish to do that manually.

Rate this Article