Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Help needed binding a static library into a Xamarin.iOS project

$
0
0

Hello All,

I'm currently in the process of porting an iOS application to Xamarin. Unfortunately, I'm fairly new to Objective C and XCode...although, I do think I've made good progress. The iOS app links to a static library (a FAT lib, i.e all architectures) which seems to be written in C++. So the external library has a libSomething.a and a libSomething.h file. The source code of the original iOS app has a *.mm file which references the "libSomething.h" and calls the various methods and functions within the static library. So, this makes sense since .mm files correspond to the C++ equivalent.

I've tried using the Binding Library and followed the Xamarin walkthrough documentation but from what I can tell, this only applies to static libraries which were originally compiled using the Cocoa Touch Library through XCode and which were using Objective C. I figured it out the hard way when running objective sharpie and it threw all kinds of errors from the header file I mentioned. However, when I passed the -c -x c++ to sharpie bind in order to instruct the compiler to use c++, I noticed that all the errors were gone. Only this time, I just have a StuctsAndEnums.cs file but no ApiDefinition.cs file. I'm not sure if this generated code is usable. It created a bunch of enums and structs along with a static CFunctions class and a bunch of methods with** [DllImport("__Internal")]**. Do I take this and modify it or should I be going down a different path altogether (such as using PInvoke to manually call methods)?

To summarize, the orignal iOS app is using a .mm file and makes calls to the static library.

I'm clearly missing something here. Any help would be appreciated.

Thanks.


Viewing all articles
Browse latest Browse all 204402

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>