Winter Winter
Winter Winter

Reputation: 173

How to reference .so library in visual studio cross platform android project?

I'm familiar with C# projects, did cross platform development with Xamarin before.

I'm trying to reuse a .so library in a visual studio cross platform android project (Mono C#)? Is this possible?

Don't even know where to start. Any suggestions welcome.

Thanks in advance.

Upvotes: 0

Views: 1978

Answers (1)

Timo Salomäki
Timo Salomäki

Reputation: 7189

Yes, it is possible. With Xamarin.Android, you can bundle native libraries into the .apk.

To actually call the code, you need to create a DllImport function declaration for the existing code to invoke. Everything else is handled by the runtime for you.

[DllImport("yourlib.so")]
private static extern int someMethod();

Further reading: Using native libraries and Interop with Native Libraries

Upvotes: 1

Related Questions