Robert Bielik wrote:
> I'm trying to call a function with prototype:
> 
> void process(List< double[] >  ins,
>             ref List<double[]> outs);
> 
> from my c++ code, but I'm a bit stumped on how to create the arguments?
> 
> Tried to retrieve the MonoClass* for System.Collections.Generic.List via
> mono_class_from_name(mono_get_corlib(), "System.Collection.Generic", "List") 
> but it
> returns NULL. 
> 
> Probably thinking wrong here?

MonoClass *klass = mono_class_from_name(mono_get_corlib(),
        "System.Collection.Generic", "List`1");


Now obtain the MonoReflectionType of this class:

MonoReflectionType *t = mono_type_get_object (mono_class_get_type (klass));

Then invoke t.MakeGenericType (new Type [] {typeof (double[]) })
with mono_runtime_invoke to obtain the constricted type
(List<double[]>).

BTW, It's easier to do this work with a managed helper method:

public static Type MakeGenericType (Type type, Type[] parms)
{
        return type.MakeGenericType (parms);
}


Robert

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

Reply via email to