Forum Xamarin.iOS

How to bind a constant structure?

AgasAgas USMember
edited April 2016 in Xamarin.iOS

Hello, I have a lib to bind which has a constant structure like this:

extern const MAMapRect MAMapRectZero;

The MAMapRect is a structure which is generated as:

[StructLayout (LayoutKind.Sequential)]
public struct MAMapRect
public MAMapPoint origin;
public MAMapSize size;

The sharpie tool generated such code for me:

partial interface Constants
// extern const MAMapRect MAMapRectZero;
[Field ("MAMapRectZero", "__Internal")]
MAMapRect MAMapRectZero { get; }

The compiler gave me this error:

BTOUCH: error BI1014: btouch: Unsupported type for Fields: MAMapRect
Task "BTouch" execution -- FAILED

According to your binding docs, I find that the [Field] attribute only supports these types:

NSString references (read-only properties only)
NSArray references (read-only properties only)
32-bit ints (System.Int32)
64-bit ints (System.Int64)
32-bit floats (System.Single)
64-bit floats (System.Double)

So in this scenario, how could I bind this constant structure? Please help, thanks!

Sign In or Register to comment.