Hello Tyler,
We already noticed that there is no good way to only specify a
sizeconst for a native array parameter. We are trying to fix this in the
next release. For now, as a work around, could you add a parameter for
passing the size of the array in your delegate signature? If yes you may
rewrite it like this
protected delegate uint ReadProc(
[MarshalAsUnmanagedType.LPArray,ArraySubType=UnmanagedType.U1,
SizeParamIndex =1 )]
byte [] fvData,
int dataSize,
UIntPtr pfvuiSize, Object fvContext);
also, you need to change your unmanaged function signature accordingly, and
pass the size in dataSize param.
SizeParamIndex above indicates that the size of the array will be given by
the parameter at index 1 (with the array parameter at index 0 for a
signature that is not marked with PreserveSig=true ?if the sig is marked
with PreserveSig then the indexing is 1 based).
If you still have problem , please let me know.
Thanks!
Best regards,
Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!
--------------------
| X-Tomcat-ID: 330961814
| References: <usvzMxdgDHA.1764@TK2MSFTNGP09.phx.gbl>
[quoted text clipped - 5 lines]
| Date: Wed, 24 Sep 2003 10:23:01 GMT
| Subject: RE: MarshalDirectiveException - Array size control parameter
must be an integral type
| X-Tomcat-NG: microsoft.public.dotnet.framework.interop
| Message-ID: <#CedRXogDHA.2624@cpmsftngxa06.phx.gbl>
[quoted text clipped - 76 lines]
| |
| | Thanks, Tyler
Tyler - 26 Sep 2003 19:46 GMT
Unfortunately, the code that invoked the delegate was not mine, so I was not
able to modify it. To work around the issue I wrote a wrapper in C++ that
modifies the parameters and then the interop works successfully. I had
really wanted to do everything in C#/managed code ... but I guess I'll have
to wait.
Thank-you very much for your help,
Tyler
> Hello Tyler,
> We already noticed that there is no good way to only specify a
[quoted text clipped - 127 lines]
> | |
> | | Thanks, Tyler