[Mono-dev] Embedded mono; getting in C a pointer from an IntPtr object

2013-02-18 Thread Jean-Michel.Perraud
Hi, I have a scenario where some C function is getting a MonoObject (*pobj) that happens to be an IntPtr. As the native pointer is known to be of a certain native type (SEXP), how do I retrieve it? I tried a few things, the latest being: type_il =

Re: [Mono-dev] Embedded mono; getting in C a pointer from an IntPtr object

2013-02-18 Thread Zoltan Varga
Hi, If you have an IntPtr object, you can simply unbox it, that will return a pointer to the value boxed inside the object, i.e., then you can dereference it to get the value: void *ptr = *(gpointer*)mono_object_unbox (obj); Zoltan On Mon, Feb 18, 2013 at 11:46 AM,