I'm trying to bind for Xamarin.iOS the Panorama SDK from dermandar (can't post the link, but I'm attaching their demo project and sdk). I'm using Sharpie version 3.5.20-c4fa1f23 and have located the static library in the DMD folder, along a .h file and an assets bundle. Positioning myself inside the DMD folder, I run:
sharpie bind --output=libDMD --namespace=libDMD --sdk=iphoneos14.3 -scope ./ ./DMD.h
I get a lot of errors like:error: cannot find protocol declaration for 'NSObject'
@protocol MonitorDelegate <NSObject>
or
error: expected a type - (void)stitchingCompleted:(NSDictionary*)dict;
However, the .cs files are generated and include the methods mentioned in the error description. Is this normal? The final lines of the output are:Done. Exiting with error code 1.
error: Clang failed to parse input and exited with code 1
I create the bindings library anyway, and stumble upon other issues:
// -(void)setCircleDetectionCallback:(DMDCircleDetectionCallback)callback withObject:(void *)object;
[Export("setCircleDetectionCallback:withObject:")]
unsafe void SetCircleDetectionCallback(DMDCircleDetectionCallback* callback, void* @object);
The DMDCircleDetectionCallback
isn't defined anywhere, though in the header file I see:
typedef void (*DMDCircleDetectionCallback)(enum DMDCircleDetectionResult res, void* obj);
Should I add this manually? Looking at some examples I ended up with a c# version, but I don't know if I'm on the right track:
// typedef void (*DMDCircleDetectionCallback)(enum DMDCircleDetectionResult res, void* obj);
delegate void DMDCircleDetectionCallback(DMDCircleDetectionResult res, IntPtr obj);
Now I get a new error: Error CS0208: Cannot take the address of, get the size of, or declare a pointer to a managed type ('Monitor.DMDCircleDetectionCallback') (CS0208) (DMDLibraryLite) here SetCircleDetectionCallback. I do unsafe void SetCircleDetectionCallback(DMDCircleDetectionCallback callback, void* @object);
, basically removing the pointer (yes, I know).
I now have on my hands a project that builds, but I made out of it a mumbo jumbo way out of my league. Any advice would be much appreciated.