I am writing a wrapper that bind to an iOS SDK using the P/Invoke as Sharpie was not able to generate a compilable code for this SDK.
When compiling the iOS App with the wrapper project referenced I am having many linking issues such as this one :
MTOUCH: error MT5210: Native linking failed, undefined symbol: std::locale::classic(). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. MTOUCH: error MT5210: Native linking failed, undefined symbol: std::__throw_bad_cast(). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. MTOUCH: error MT5210: Native linking failed, undefined symbol: std::invalid_argument::invalid_argument(std::string const&). Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. (Please find the complete log on this complete log file.)
The extra mono touch argument passed from the iOS project are described below:
-cxx -v -gcc_flags "-L${ProjectDir} -lstdc++ -lresolv -liconv -lxml2 -lz -ObjC -force_load ${ProjectDir}/Libs/libcrypto.a" -cxx -v -gcc_flags "-L${ProjectDir} -lstdc++ -lresolv -liconv -lxml2 -lz -ObjC -force_load ${ProjectDir}/Libs/libssl.a" -cxx -v -gcc_flags "-lstdc++ -lresolv -liconv -lxml2 -lz -ObjC -L${ProjectDir} -framework Security -framework CoreVideo -framework CoreMedia -framework AVFoundation -framework CFNetwork -framework Accelerate -framework AudioToolbox -framework CoreAudio -framework Foundation -framework CoreGraphics -framework UIKit -force_load ${ProjectDir}/Libs/libsipwrapper.a -dead_strip -all_load"
The SDK is composed of three libraries : libcrypto.a, libssl.a and libsipwrapper.a.
Following many articles/posts on the internet, it is recommended to add add the standard library such as -lstdc++, lz, and ObjC, but this not seems to work on my case.
I have also tried to create a Binding Project that includes the three libraries and the wrapper code, the content added to the linkwith files seems like that :
[assembly: LinkWith ("libsipwrapper.a", LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Arm64, Frameworks = "CoreVideo CoreMedia AVFoundation CFNetwork Accelerate AudioToolbox CoreAudio Foundation CoreGraphics UIKit", ForceLoad = false, SmartLink = true, IsCxx = true, LinkerFlags = "-lstdc++ -lresolv -liconv -lxml2 -lz -ObjC")]
The problem was not resolved and I continue to have the described linking errors.