How to call methods of a .so file from Xamarin Android?

对着背影说爱祢 提交于 2019-12-24 10:08:02

问题


I have a .so file from an Android driver manufacturer. They provide an example in Java. The problem is that my app is developed in Xamarin Android. Is it possible to call methods of a .so file from Xamarin?


回答1:


1.Create a lib folder in your project

2.Under that create additional subfolders for the platform: armeabi, armeabi-v7a etc.

3.Add your .so files to the appropriate directory. Make sure they are set to type AndroidNativeLibrary or whatever it is.

4.Create p/invoke signatures for the c functions you want to call.

5.Call those functions.

Note: Your .so files should be valid EFL executables. It means they should be compiled for ARM processor in Android Devices. In order to do this, you should compile them with Android NDK

Goodluck!



来源:https://stackoverflow.com/questions/47577462/how-to-call-methods-of-a-so-file-from-xamarin-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!