[英]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. 我熟悉C#项目,之前曾与Xamarin进行跨平台开发。
I'm trying to reuse a .so library in a visual studio cross platform android project (Mono C#)? 我想在Visual Studio跨平台android项目(Mono C#)中重用.so库? Is this possible? 这可能吗?
Don't even know where to start. 甚至都不知道从哪里开始。 Any suggestions welcome. 任何建议欢迎。
Thanks in advance. 提前致谢。
Yes, it is possible. 对的,这是可能的。 With Xamarin.Android, you can bundle native libraries into the .apk
. 使用Xamarin.Android,您可以将本机库捆绑到.apk
。
To actually call the code, you need to create a DllImport
function declaration for the existing code to invoke. 要实际调用代码,您需要为要调用的现有代码创建DllImport
函数声明。 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 进一步阅读: 使用本机库和与 本机库 互操作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.