Reputation: 183
I have NeoSpeech library (text to speech) for IOS having .a , .h & database files. This library is working fine in ios . Now i have to consume this library in Xamarin project. I am trying to consume using static library but it is not possible to call a library inside other so i am not able to use neospeech library inside static library. There is another option in xamarin i.e. Native C linking with xamarin but there is no proper documentation for this. Also is it good to use Linking Native Libraries in my scanrio. Please help me.
Thanks
Upvotes: 3
Views: 432
Reputation: 3197
Try to use Objective Sharpie it takes header files (not .a file) and produces C# api definition files: ApiDefinition.cs and StructAndEnums.cs. Sometimes depend on you h files it generates only StructAndEnums. It may be ok, but if it isn't sharpie should report some errors that you can search over SO.
Then you can create Binding project refer .a file there and generated ApiDefinitions. If you have separate .a for different processor architectures you can make FAT-library in Mac OS bash using lipo
and refer only fat lib. For yours libs it'll be:
lipo -create libvt_eng_james_univ.a, libvt_eng_james_armv77s64.a libvt_eng_beth_simulation.a -output lib_eng_james_fat.a
May be libvt_eng_james_univ.a is already fat, You can check it by
lipo -info libvt_eng_james_univ.a
It'll show you all architectures in fat lib: i386 x86_64 for simulator armv7, armv7s arm64 for device.
After that just refer this binding project from you main Xamarin project as simple library proj. And then you can use all classes just like from other libraries.
Upvotes: 1
Reputation: 1294
Seems like you have the same problem with me, check my question, there is a wonderful answer for link Objective-C's library to Xamarin.
How to bind an Objective-C static library to Xamarin.iOS?
Hope it can help you.
Upvotes: 0