ChartBoost Static Library and Flex Native Extension

During one of the project there was requirement to create a native extension for ChartBoost SDK as explained by Sameer in this post. ChartBoost gives a static library as form of SDK with couple of header files. Using header files in an XCode project I created a static library from which an extension can be easily created using adt. Though the problem was to merge the static library from ChartBoost with the library I created for extension. On top of that the library from ChartBoost had symbols for both armv7 and i386 architecture while for extension we needed only the armv7 architecture.

So the first step was to extract the armv7 library from the ChartBoost static library.

lipo -output libChartBoostarmv7.a -thin armv7 libChartBoost.a

Above commands extracts the armv7 symbols in another static library package. Its very important to specify -thin so we don’t end up with another fat library. We copied libChartBoostarmv7.a and libChartBoostExtension.a in one folder.

mkdir CombinedStaticLib

cp libChartBoostarmv7.a CombinedStaticLib/

cp libChartBoostExtension.a CombinedStaticLib/

Now we extract symbols from both the libraries and combine them using the ar command:

ar -x libChartBoostExtension.a
ar -x libChartBoostarmv7.a
ar -crs libCB.a *.o

libCB.a is the final static library. Using following command one can easily create the ANE file:

Flex_SDK_PATH/bin/adt -package -target ane ../release/ChartBoostExtension.ane extension.xml -swc ChartBoost.swc -platform  iPhone-ARM library.swf libCB.a

I hope you enjoyed some technical process behind the extension we created.


Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Trackbacks and Pingbacks: