It should be same as pointer to an array. void Receive(/*...*/ unsigned char (*SampleData) __gc []) { *SampleData = new unsigned char __gc[10]; }
/// unsigned char b __gc[]; Receive(&b); /// ----- Original Message ----- From: "Thomas Tomiczek" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, April 13, 2002 1:53 PM Subject: [DOTNET] AGAIN: How to define OUT parameter in Managed C++ interface for interop with C#? I have a function that looks like void Receive([Out, MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_UI1)] out byte [] SampleData); In C# - this is, btw, a line out of a COM interop interface definiition. I cant use a TLBIMP here - no typelib defined for this, sadly. Now, I move this C# code (and the interface is only used internally in the assembly) over to managed C++ (some things this COM object des are better done in C++), so I need to get this interface defined in managed C++ (as, again, it is an interface of an external com object. How to I rewrite this in C++? void Receive([Out, MarshalAs(UnmanagedType::SafeArray, SafeArraySubType = VarEnum::VT_UI1)] unsigned char SampleData __gc []); Is wrong - the SampleData parameter is NOT an OUT parameter, as it should be. void Receive([Out, MarshalAs(UnmanagedType::SafeArray, SafeArraySubType = VarEnum::VT_UI1)] unsigned char *SampleData __gc []); Throws a compiler error (C2691) void Receive([Out, MarshalAs(UnmanagedType::SafeArray, SafeArraySubType = VarEnum::VT_UI1)] unsigned char SampleData __gc []); Throws a compiler error (C2234) I have done quite an amount of managed C++ so far, but this is the first time I need to turn over an array to managed C++. Can anyone clear me up on the syntax here please? Regards Thomas Tomiczek THONA Consulting Ltd. (Microsoft MVP C#/.NET) You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.