简体   繁体   中英

How to wrap a huge static C++ library in Objective-C?

I need to use a huge static C++ library in Xamarin.iOS project, I have only one .a and tons of *.h files. So I have to wrap headers with Objective-C to run Xamarin Sharpie tool. Any suggestions how to do it?

To acess the methods from native libraries, you use Mono's P/Invoke functionality which is the same technology that you would use in .NET, which is roughly:

  • Determine which C function you want to invoke
  • Determine its signature
  • Determine which library it lives in
  • Write the appropriate P/Invoke declaration

You can find the more information on this blog here: http://kerry.lothrop.de/c-libraries/

CppSharp is another option that is mentioned in the comments

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM