Re: [Mono-dev] how to coerce MonoObject* holding a System.Type to MonoClass*

2011-12-14 Thread Rodrigo Kumpera
Hi Jonathan, If you're using trunk, Zoltan Varga added a mono_reflection_type_get_type to handle that. On Tue, Dec 13, 2011 at 11:47 AM, Jonathan Shore jonathan.sh...@gmail.comwrote: Thanks. That works On Mon, Dec 12, 2011 at 7:01 PM, Rodrigo Kumpera kump...@gmail.comwrote: There are two

Re: [Mono-dev] how to coerce MonoObject* holding a System.Type to MonoClass*

2011-12-14 Thread Jonathan Shore
Thanks, Is it possible to get the reverse as well, from either MonoType* or MonoClass* - a System.Type object? On Wed, Dec 14, 2011 at 6:14 AM, Rodrigo Kumpera kump...@gmail.com wrote: Hi Jonathan, If you're using trunk, Zoltan Varga added a mono_reflection_type_get_type to handle that.

Re: [Mono-dev] how to coerce MonoObject* holding a System.Type to MonoClass*

2011-12-14 Thread Zoltan Varga
Hi, Try mono_type_get_object () in reflection.h. Zoltan On Wed, Dec 14, 2011 at 8:51 PM, Jonathan Shore jonathan.sh...@gmail.comwrote: Thanks, Is it possible to get the reverse as well, from either MonoType* or MonoClass* - a System.Type object? On Wed, Dec 14, 2011 at

Re: [Mono-dev] how to coerce MonoObject* holding a System.Type to MonoClass*

2011-12-13 Thread Jonathan Shore
Thanks. That works On Mon, Dec 12, 2011 at 7:01 PM, Rodrigo Kumpera kump...@gmail.com wrote: There are two ways, you can do it from managed land directly: Type t = ...; return t.TypeHandle.Value; This will give you a MonoType* (which is easy to convert to a MonoClass*). The other option

[Mono-dev] how to coerce MonoObject* holding a System.Type to MonoClass*

2011-12-12 Thread Jonathan Shore
I have a method call that returns System.Type. I want to make use of the type and do some reflection from C++. Have code like this: MonoClass* klass = (MonoClass*)mono_runtime_invoke (...); I am pretty sure that the casting to MonoClass* is not appropriate. The mono_runtime_invoke() function

Re: [Mono-dev] how to coerce MonoObject* holding a System.Type to MonoClass*

2011-12-12 Thread Rodrigo Kumpera
There are two ways, you can do it from managed land directly: Type t = ...; return t.TypeHandle.Value; This will give you a MonoType* (which is easy to convert to a MonoClass*). The other option is pretty shitty, due to a silly limitation in mono's embedding API. What you do is fetch the _impl