[Mono-dev] Problem with Marshing c arrays as UnmanagedType.LPArray using SizeParamIndex when doing Native -> Managed COM method calls.

Robert Jordan robertj at gmx.net
Fri Jun 12 14:08:02 EDT 2009


Tom Hindle wrote:
> When checking param index type (which is 1 as SizeParamIndex == 1)
> (about line 6778) the Array itself is being checked (byte[] pv) as
> m->sig has had and extra parameter inserted at the beginning of its
> parameter list. (which I assume is for communicating the HRESULT return
> value back to the C++ as this is a COM method call.)

It's the converted "this" arg of the managed sig at the front
of the unmanaged sig.

> Could someone tell me if this is the correct place to adjust the
> param_num or should 
> spec->data.array_data.param_num be expected to contain the adjusted
> value?

There are apparently 2 places in cominterop.c where
spec->data.array_data.param_num has to be increased by one.

The attached patch is fixing one place, but there seems
to be another one in cominterop_get_native_wrapper_adjusted.

Please try it out as I don't have a test case.

Robert

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cominterop.diff
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090612/6fb86ab4/attachment.pl 


More information about the Mono-devel-list mailing list