ios - How to include C++ library in Xcode -


i migrating android application, uses c++ library ios. c++ library provides main application functionality app. possible include c++ library in xcode project?

i know apple llvm compiler can compile c code, possible solution may compile c++ code shared library , provide c wrapper able access c++ code objective-c. similar solution adopted android app , jni.

yes, can.

there 2 ways of doing this.

the easiest way add sources inside ios project. if have sources of library , can add project, make sure have main file (and other objective c files) named .m .mm let xcode compiling c++.

if want go static linkage, recommend create static library project , add same workspace objective c main project , declare dependency build target (check build targets / build schemas ... xcode stuff on here :) ).

if want provide static library binary , go static linkage there (which don't recommend , no breakpoints , other pain along way) have keep in mind following :

  • you need have separately compiled static library each different platform (ios simulator different iphone, arm64 , armv7 , armv7s ) , link accordingly
  • an alternative above way make fat lib (universal lib)

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -