简体   繁体   English

如何在Visual Studio跨平台android项目中引用.so库?

[英]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.

相关问题 在 Visual Studio 中引用一个项目并为特定平台构建它 - Reference a project in Visual Studio and build it for a specific platform 如何在Visual Studio 2010中引用C#类库项目? - How to reference a C# Class Library project in Visual Studio 2010? Visual Studio 2017将无法编译Xamarin跨平台项目 - Visual Studio 2017 will not compile xamarin cross platform project 在Visual Studio中对具有不同目标平台的另一个项目的项目引用 - Project reference to another project with different target platform in Visual Studio Visual Studio-如何添加非nuger库,以便它可以与源代码管理(tfs)一起使用,而不引用本地文件? - Visual Studio - How to add non nuger library so that it can work with source control (tfs) and not reference local file? 如何使用Visual Studio开发跨平台移动应用程序 - How to develop cross platform mobile application using Visual Studio 如何在Visual Studio 2010中引用辅助项目 - How to reference a secondary project in Visual Studio 2010 如何在 Visual Studio 中添加对项目的 a.dll 引用 - How to add a .dll reference to a project in Visual Studio 如何在.NET核心类库中引用Visual Studio共享项目 - How do I reference a Visual Studio Shared Project in a .NET Core Class Library 如何公开由类库引用的类库,该类库随后作为项目引用包含在Visual Studio中? - How do I expose class libraries referenced by a class library, which is then included as a project reference in Visual Studio?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM