Forum Xamarin.iOS


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Sharpie - Bindings Library - issues

EndareaEndarea Member ✭✭

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>


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:

  1. I add the .a library and expect to see the generated code-behind with the [LinkWith] attribute, but there's nothing there. I'm using Visual Studio for Mac.
  2. I fill in the ApiDefinition.cs file and get an error (Error CS0246: The type or namespace name 'DMDCircleDetectionCallback' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (DMDLibraryLite)) here:

// -(void)setCircleDetectionCallback:(DMDCircleDetectionCallback)callback withObject:(void *)object;
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.

Sign In or Register to comment.