ios - 将 iOS 静态库绑定(bind)到 Xamarin.iOS 并使用 dll

标签 ios xamarin.ios static-libraries xamarin

我能够为我的 Objective-C 静态库成功创建 dll 文件。但是,当我尝试从 Xamarin.iOS 应用程序引用该 dll 并进行编译时,它给了我很多错误,例如...

Error MT5210: Native linking failed, undefined symbol: _AudioFileClose. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. (MT5210)

Error MT5210: Native linking failed, undefined symbol: std::ios_base::Init::Init(). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. (MT5210)

Error MT5202: Native linking failed. Please review the build log. (MT5202)


在此之后,我尝试使用附加 mtouch 参数链接我的 .a 库。添加这些参数后,我收到了新错误。

Could not parse the command line arguments: Cannot bundle unregistered option '-o'.

有人可以帮我解决这个问题吗。

最佳答案

正如 Stephane 所提到的,LinkWithAttribute 上有一个 IsCxx 属性,您可以设置它来指定 .a 库是一个 C++ 库。这将解决 std::ios_base::Init::Init() 错误。

要解决 undefined symbol: _AudioFileClose 错误,您可以尝试将 CoreAudio 或 AudioToolbox 框架添加到要链接的框架列表中:

[assembly: LinkWith (..., IsCxx = true, Frameworks = "CoreAudio AudioToolbox")]

希望即使这不太奏效,它也会让您朝着正确的方向前进。

关于ios - 将 iOS 静态库绑定(bind)到 Xamarin.iOS 并使用 dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20715530/

相关文章:

c# - 经常播放 AVAudioPlayers 导致 SIGSEGV?

assembly - 如何将 .a 库与 .asm 文件链接?

ios - 为什么子类化是不可取的?

ios - 有没有办法设置 RadioGroup 的背景颜色?

ios - 使用 Xamarin 的简单多列表

objective-c - 静态库中的委托(delegate)在 Xcode 中不起作用

c++ - 如何找出依赖于 LIB 文件的 DLL 列表?

ios - 如何关闭 PushViewController?

ios - 点击通知时在UITableViewCell中显示相应的内容?

ios - 如何初始化一个CKAsset?