Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have written a good chuck of common code in C++ for my diagramming app "Lekh Diagram"(http://www.avabodh.com/lekh). The shape recognition, shape management etc all done in C++ code. The app is available for Android and iOS.

Integrating the C++ code with Objective C is much smoother experience than the Java in android.

As the Objective C (more precisely objective C++) is superset of C++, I can directly call C++ code from objective C and for other way communication (calling objective C code from C++), I had defined an C++ interface. The C++ code calls on interface only and the interface is implemented in objective C.

For Android, little more work was required. I had write wrappers code. I also had to hit many stupid issues like local reference table overflow etc.



The shape recognition from drawings looks great! I've been looking to use something like this in a project of mine, any pointers you would like to provide, if possible?


Objective-C also runs on Android with Apportable. Less of a headache. :-)


It might, but unfortunately, you can't build a library with it. It only transforms whole apps. Apportable was investigated in the first part here http://www.skyscanner.net/blogs/developing-mobile-cross-plat...


Not once did the article talk about the C++ ABI which is one of the most important things a library developer needs to be aware of (as opposed to an application developer).

The C++ ABI is unstable. You can't effectively deploy 3rd party libraries with that either.

Android ships with multiple versions of the compiler, each one of those are incompatible with each other's standard library. On top of that, Android ships multiple C++ standard libraries for each compiler, all of which are not-interoperable either. Then Android updates the compiler with each NDK drop introducing more potential incompatibilities.

The end result is you can't deploy prebuilt C++ libraries (a prickly issue for commercial/proprietary code) unless you can force users to use your exact toolchain. But library writers usually can't fairly dictate those terms, especially if the users want intermix libraries from other sources which may use a different toolchain.


It does actually let you build libraries, just not entirely documented.

You are right though. Those libraries will link Apportable's extended/improved libc (called libv) and libc++ and would require distributing more parts of the platform (it can get a little hairy there). It is also true that the out of the box experience is one that is meant for just apps but it's built on a layer cake and at a lower level you can use it to compile libraries. This is how it builds dependencies in your Xcode project today.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: