On 23.01.2013 06:43, tomason wrote:
MonoClass *mclass = mono_object_get_class(mobj);
g_mmethod = mono_class_get_method_from_name(mclass, "Add", 2);
g_mthunk = (MonoAddFunc)mono_method_get_unmanaged_thunk(g_mmethod);
Where MonoAddFunc is defined like this:
typedef float (*MonoAddFunc)(MonoObject*, float, float);
This is the C# Add method:
public float Add(float a, float b) {
return a + b;
}
Oops, I didn't notice that the signature doesn't include
the mandatory MonoException** pointer. It should read:
typedef float (*MonoAddFunc)(MonoObject*, float, float,
MonoException**);
MonoException* ex;
g_mthunk(g_mobj, 0.00001f, 0.00002f, &ex);
if (ex) {
// handle exception
}
That's why your test was failing.
Robert
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list