我能够为我的 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/