语言

Menu
Sites
Language
Native library (shared .so files) for .Net application

Hi !

I would like to add native libraries to Xamarin projects in visual studio. Is that possible ? How do you do that ? Or is it a planned feature ?

 

I would be happy to collaborate with you on this!

 

/Anders

响应

4 回复
Armaan-Ul- Islam

I've seen the .so library integration process over the Internet...Though the below one is for Xamarin android...I expect relevant behavior..

https://docs.microsoft.com/en-us/xamarin/android/platform/native-libraries

https://forums.xamarin.com/discussion/27692/native-library-so-adding-in-android-library-project

 

Sangwook Kim

If you have .so files of a specific architecture (a device or an emulator, not both), you can just put the files in lib/ directory of your project before packaging the app.

Then you can use standard PInvoke to interop with the native library in your managed code.

 

I'm not sure if the Tizen SDK supports a bundle of .so files for multiple ABIs in one package though.

Sangwook Kim

For example, a shared library "libA.so" built for the armv7l architecture should be added as "lib/armel/libA.so" in the application package, and invoked from C# code using [DllImport("A.so")].

Note that this doesn't work on TV devices because native code execution is now allowed on TVs at the moment.

Sangwook Kim

now → not