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

carmack2000 carmack2000 at hotmail.com
Wed Apr 16 20:31:36 UTC 2014


I use mono_object_unbox to get an object instance (Vector2) passed from C# to
C++.
C++
__declspec(dllexport) void SetPosition(MonoString* ms, MonoObject* mo)
{
	Vector2 pos = *(Vector2*)mono_object_unbox(mo);
}

C#
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern void SetPosition(string name, object o)

If I need to pass an object as ref or out instead of value, how can I
implement it in C++ side ?

Like this sample, I want to pass object o as ref.
C#
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern void SetPosition(string name, ref object o)



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


More information about the Mono-list mailing list