
Signature
http://www.mkcs.at/
The specified e-mail-address is valid and will be read.
Michael,
>The last argument ("ODs") is a conformant array. My problem is that I
>could not yet find a solution how to make such an array in C# and set
[quoted text clipped - 4 lines]
>
>Does anyone have an idea?
If Size is the number of elements in the array, you can try something
like this
void GetSObjDesc(int Start, int Size, out int Length, [Out,
MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] Lib.SOD[] ODs);
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Michael Kremser - 28 Jun 2005 13:11 GMT
Hi Mattias,
Thanks for your answer!
> If Size is the number of elements in the array, you can try something
> like this
>
> void GetSObjDesc(int Start, int Size, out int Length, [Out,
> MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] Lib.SOD[] ODs);
No, Length is the size of the array.
I tried your method and also fit the wrapper (I dissassembled it using
disasm, changed the signature from
instance void GetSObjDesc([in] int32 Start,
[in] int32 Size,
[out] int32& Length,
[out] valuetype Lib.SOD&
ODs) runtime managed internalcall
to
instance void GetSObjDesc([in] int32 Start,
[in] int32 Size,
[out] int32& Length,
[out] valuetype Lib.SOD[]&
ODs) runtime managed internalcall
It compliled all successfully, but it did not run as excpected.
I changed the implementation as follows:
public void GetSObjDesc(int Start, int Size, out int
Length,[Out,MarshalAs(UnmanagedType.LPArray, SizeParamIndex=2)] out Lib.SOD[]
ODs)
I also tried to set SizeParamIndex to 1.
I don't have a clue why it does not work and what I did wrong. :-/ I already
thought that I just could "serialize" my array to a byte[] and give the
caller a IntPtr to it. Could this work?
BR,
Michael
Michael Kremser - 28 Jun 2005 13:53 GMT
I also found now another IDL file that is more specific:
HRESULT GetSObjDesc([in] long Start, [in] long Size, [out] long *Length,
[out, size_is(Size), length_is(*Length)] SOD * ODs);