Evgeny
Evgeny

Reputation: 641

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?

Upvotes: 0

Views: 290

Answers (1)

Prashant Cholachagudda
Prashant Cholachagudda

Reputation: 13092

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

Upvotes: 1

Related Questions