user1407804
user1407804

Reputation:

Xamarin: Using Native library

1) In case of availability of iOS and Android Native libraries, what will be the appropriate, efficient and easier step to take, in order to use the library for the development of a cross platform application? Binding Android library or the iOS? If we bind the Android native library, will we be able to use this binded library in the Xamarin.iOS application and vice versa?

2) In case of availability of a a C++ library, is it possible to use this library to develop a cross platform application?

Thanks in advance!

(Just a beginner in Xamarin, so excuses if the question seems to be inappropriate)

Upvotes: 6

Views: 3866

Answers (1)

Rolf Bjarne Kvinge
Rolf Bjarne Kvinge

Reputation: 19345

  1. Native iOS and Android libraries are usually quite different (iOS libraries are commonly written in Objective-C and Android libraries in Java), and because of this the bindings for each will differ. Even if the API was identical, the difference between Objective-C and Java is enough for the bindings to have to be different too.

  2. Yes, it is possible to use C++ in iOS and Android projects, but the mechanism is different. There are a couple of options here:

    • Use a tool such as SWIG to create managed bindings for the C++ library. This is also an interesting read.

    • Create a C library which wraps the C++ library, and then use the standard P/Invoke mechanism available in managed code to interact with the C library.

Upvotes: 2

Related Questions