在 Xamarin iOS 项目中链接 libz.dylib 和 libsqlite3.dylib [英] Linking libz.dylib and libsqlite3.dylib in Xamarin iOS Project

查看:31
本文介绍了在 Xamarin iOS 项目中链接 libz.dylib 和 libsqlite3.dylib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个需要以下框架的 Xamarin iOS 绑定项目:

I created a Xamarin iOS binding project that requires the following frameworks:

SystemConfiguration.framework
CoreTelephony.framework
libz.dylib
libsqlite3.dylib

我在我的 iOS 绑定项目中添加了以下行到 linkwith.cs 文件:

I added the following line in my iOS binding project to the linkwith.cs file:

Frameworks = "SystemConfiguration CoreTelephony"

这似乎工作正常,并告诉该项目在绑定时包含这些框架.从我读到的内容来看,听起来需要将剩余的 2 个库添加为项目中的链接器标志,这些库是指从我的 iOS 绑定项目生成的 DLL.所以我创建了一个测试应用程序,导入了 DLL,现在需要添加链接器标志,但我的项目找不到正确的库.

This seems to work correctly and tells that project to include these frameworks when binding. From what I have read, it sounds like the remaining 2 libraries need to be added as linker flags in the project referring to the DLL generated from my iOS binding project. So I created a test app, imported the DLL, and now need to add the linker flags but my project cannot find the right libraries.

我在 Xamarin Studio 中的链接器标志如下:

My linker flags in Xamarin Studio are as follows:

-gcc_flags "-lz -lsqlite3.0"

当我构建我的 Xamarin 测试应用程序时,我收到一些关于无法找到的框架的错误.是否有需要链接的额外标志,或者我需要在我的 iOS 绑定项目中做一些额外的配置吗?

When I build my Xamarin test app I get a few errors regarding the frameworks that cannot be found. Are there additional flags that need to be linked or do I need to do some additional configuration in my iOS binding project?

推荐答案

我找到了一个很好的资源:http://ipixels.net/blog/specify-extra-gcc-flags-for-native-library-binding-in-xamarin-ios/

I found a great resource: http://ipixels.net/blog/specify-extra-gcc-flags-for-native-library-binding-in-xamarin-ios/

我需要将 LinkerFlags = "-lz -lsqlite3.0" 添加到我的 .linkwith.cs 文件中.然后我重建了库以生成一个新的 DLL 并将其添加到我的测试应用程序中.然后测试应用程序正确构建.

I needed to add LinkerFlags = "-lz -lsqlite3.0" to my .linkwith.cs file. I then rebuilt the library to generate a new DLL and added this to my test app. The test app builds correctly then.

这篇关于在 Xamarin iOS 项目中链接 libz.dylib 和 libsqlite3.dylib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆