I am using C to invoke Mono and it is working well. A few weeks ago I hit an issue where I was calling a few functions that returned a boolean from Mono. I changed those functions to return an integer ( I cast the boolean to an int and did Math.Abs on that int in Mono) and just set the returned int to a bool in C. That worked fine, but now I am re-evaluating and cleaning some things up. What would be the best way to take a MonoObject* referencing a Boolean and get a C bool out of it (or a integer representing the value of that boolean).

I have a couple of ideas for ways to do this that I know would work, but I have a feeling there is an easier way.

In other words, how can I get a C bool (or an int where false=0 and true is anything else) out of the monOb in this code:

MonoMethodDesc *monoMethDesc2 = mono_method_desc_new (":callSomeMethodThatReturnsABoolean()",FALSE); MonoMethod *meth2= mono_method_desc_search_in_class (monoMethDesc2, myMonoClass); MonoObject* monOb = mono_runtime_invoke (meth2, theObjectThatOwnsTheMethodThatReturnsABoolean, NULL, NULL);


Thanks in advance.
Kevin
_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to