Rahim
Rahim

Reputation: 33

c++ library in C# IOS project in Visual studio

I have created a C++ static library for ios (XCode 6.1) in visual studio. But when I compile this project, the output .a file is getting created in Mac machine and not getting copied back to Windows. My concern is that how can I refer this static library in an iOS C# application project in Visual studio?

Upvotes: 3

Views: 1248

Answers (1)

dalexsoto
dalexsoto

Reputation: 3412

So you have several options here, what you need to do is to have a Dll that contains the native .a library and the resources/code to interop with the native c++ library (and reference that Dll in your Visual Studio Xamarin.iOS project). You can use a Xamarin iOS Binding project as a container and one of the following options

  • You can use swig to wrap the c++ lib and there is actually a video from Xamarin University lighting lectures from Chris Van Wyk that describes the process.

  • You can use Mono CppSharp to wrap the library (My personal favourite easier to use than swig).

  • You can write your own c wrapper around the c++ library and P/Invoke that from C#

  • You can write your own Objective-C wrapper around the c++ library and use a Xamarin.iOS Binding project to interop with it.

    Hope this helps.

Upvotes: 2

Related Questions