Delen via


Creating Bindings with Objective Sharpie

This section provides an introduction to Objective Sharpie, Xamarin's command line tool used to automate the process of creating a binding to an Objective-C Library

Overview

Objective Sharpie is a command line tool to help bootstrap the first pass of a binding. It works by parsing the header files of a native library to map the public API into the binding definition (a process that previously was manually done).

Objective Sharpie uses Clang to parse header files, so the binding is as exact and thorough as possible. This can greatly reduce the time and effort it takes to produce a quality binding.

Important

Objective Sharpie is a tool for experienced Xamarin developers with advanced knowledge of Objective-C (and by extension, C). Before attempting to bind an Objective-C library you should have solid knowledge of how to build the native library on the command line (and a good understanding of how the native library works).

History

We have been evolving and using the Objective Sharpie internally at Xamarin for the last three years. As a testament to the power of Objective Sharpie, APIs introduced in Xamarin.iOS and Xamarin.Mac since iOS 8, Mac OS X 10.10, and watchOS 2.0 were bootstrapped entirely with Objective Sharpie. Xamarin relies heavily on Objective Sharpie internally for building its own products.

However, Objective Sharpie is a very advanced tool that requires advanced knowledge of Objective-C and C, how to use the clang compiler on the command line, and generally how native libraries are put together. Because of this high bar, we felt that having a GUI wizard sets the wrong expectations, and as such, Objective Sharpie is currently only available as a command line tool.