What goes into an AIR Native Extension for Mac OS?

Opt In Image
Early bird offer on the ANE eBooks

 

Buy any Easy Native Extensions 2nd Edition package and get our $99 iOS + Android ANE Template completely free before the end of June 2015.

 

 

  • step-by-step guide to making your iOS extension in under an hour
  • library for data conversion between ActionScript and native code
  • tutorials
  • infographics
  • code included

Let me guess, your horoscope for today says that you’ll have a productive day if you focus on the important things. Let’s get on with it.

Here is a bit of prerequisite information, in case you need it:

Next, the ingredients for an ANE for Mac OS fall into two categories: libraries you have to make and a framework that’s already there for you to use.

Libraries you have to make:

  • an AIR library, compiled as a .swf file;
  • a native C, C++ or Objective-C library, compiled as an .a file.

The communication by these two libraries is handled by the third component, which Adobe has provided for you:

  • the AIR C API.

The AIR library

The AIR library component of an ANE is like any other AIR library (Flex library project) with one exception: it has to contain an instance of flash.external.ExtensionContext. It’s through this class that the ActionScript side of your ANE will communicate with the AIR C API.

The AIR C API

Think of the AIR C API as the layer that sits between your ActionScript code and your native code. It is compiled into your native library and is responsible for ‘translating’ ActionScript calls into C and vice-versa.

For Mac OS the AIR C API is implemented as a framework: Adobe AIR.framework, which you include in your native library, together with the header file FlashRuntimeExtensions.h. You can see both of these in red in the diagram below.

The native library

You will typically have to write your native library in C, C++ or Objective-C and compile it into an .a file. Xcode is the tool normally used for that.

Mac OS native library

The ANE package

In order to be used as a native extension, your AIR and your native libraries need to be packed in an .ANE file. Adobe’s ADT command line tool does that for you. We will see how in Recipe for packaging an ANE.

Mac OS ANE structure

What else?

Over to you

Do you know how to debug the native part of your extension on Mac OS? We would love to meet you if you do. Give us a shout in the comments below.


Warning: count(): Parameter must be an array or an object that implements Countable in /home/easyna6/public_html/easynativeextensions_wp/wp-includes/class-wp-comment-query.php on line 399

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">