< All FAQs

Can I reuse C++ Libraries?

{N} is a bridge to Android/iOS APIs. Consuming C++ libraries in Android and iOS requires a thin native shim (Java/Objective C) that loads the native library into the process and calls the appropriate APIs. This shim is the glue point between the C++ code and the NativeScript Runtimes that read shim’s APIs and exposes the APIs in JavaScript.

You will need to add some glue code. How much – depends on the granularity of the C++ APIs and how many distinct APIs need to be available in the JavaScript layer. This is an architectural design decision. NativeScript will support an arbitrary number of public functions, you'll be in charge of mapping the public functionsto the correct functions in the C++ library layer. 

For Android, wrap the Java shim & the C++ *.so file inside of an *.AAR package. For iOS, link the C++ code in an Objective C framework. We recommend you expose these shims to NativeScript through a {N} plugin containing implementations for both iOS and Android. 


Sponsored by progress-logo-min
NativeScript is licensed under the Apache 2.0 license
© 2018 Progress Software Corporation. All Rights Reserved. Privacy Center