[Mono-dev] Embedded API: unsafe int * query

Jonathan Mitchell lists at mugginsoft.com
Tue Feb 7 23:08:12 UTC 2017


On MacOS I have updated my Obj-C - Mono bridge from using a custom built 64 bit version of Mono 4.0 to the current fat binary Mono 4.8
My unit tests are happy with one exception.

Consider:

c# 
Class RefObject {
public IntPtr Pointer { get; set; }
public unsafe int * Int32Pointer { get; set; }
}

Obj-C Test
    [refObject setInt32Pointer:&theInt];
    int32_t *int32Pointer = [refObject int32Pointer];
    XCTAssertTrue(int32Pointer == &theInt, DBUEqualityTestFailed);
    XCTAssertTrue(*int32Pointer == theInt, DBUEqualityTestFailed);

On Mono 4.0 I could pass pointers via the embedded API without issue.
On 4.8 (and perhaps earlier) the public unsafe int * Int32Pointer test always fails.
public IntPtr Pointer { get; set; } works fine in all cases.

Was the embedded API marshalling of unsafe pointers changed relatively recently?
I am not sure quite where to look in the source for this one.

Jonathan




More information about the Mono-devel-list mailing list