Re: Embedded API: thunk value type parameters and return types

Robert Jordan <[email protected]> Fri, 23 Sep 2016 13:17:37 +0200
Newsgroups gmane.comp.gnome.mono.general
Message-ID <[email protected]>
Hi Jonathan,

On 22.09.2016 22:22, Jonathan Mitchell wrote:
> I am trying to upgrade some method invoke based code to used thunks.
>
> The comments for mono_method_get_unmanaged_thunk() say:
>
>  * LIMITATIONS
>  *
>  * Value type arguments and return values are treated as they were objects:
>  *
>  * C#: public static Rectangle Intersect (Rectangle a, Rectangle b);
>  * C:  typedef MonoObject* (*Intersect)(MonoObject*, MonoObject*, MonoException**);
>  *
>  * Arguments must be properly boxed upon trunk's invocation, while return
>  * values must be unboxed.
>
> However it seems that primitive value types are returned unboxed while non primitive value types are not.
> Does the same apply for thunk parameters?
> Are primitive value parameters based by value and non primitive value parameters as a boxed reference?

The limitation only applies to "complex" value types:

(type.IsValueType && !type.IsPrimitive) == true

Robert


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