[Mono-list] How to pass an object as ref or out

carmack2000 carmack2000 at hotmail.com
Thu Apr 17 14:55:38 UTC 2014

After I followed your code I got this error:
Unhandled exception at 0x100b8c87 in MonoScriptingTest.exe: 0xC0000005:
Access violation reading location 0x00000000.
I'll look into this.

You said 'This is no better than the former non-ref version.' If I want to
use ref-object to return values (GetPosition), how can I get it ?

public static extern void GetPosition(string name, ref Vector2 o)

C++: still doing like this ?
void GetPosition(MonoString* ms, MonoObject** mo) 
        Vector2 pos = *(Vector2*)mono_object_unbox(*mo); 
        pos.x = xxxx; // Returned to the caller
        pos.y = xxxx;

View this message in context: http://mono.1490590.n4.nabble.com/How-to-pass-an-object-as-ref-or-out-tp4662539p4662544.html
Sent from the Mono - General mailing list archive at Nabble.com.

More information about the Mono-list mailing list