Hi
Based on my test, it seems to be works at my side based on the IDE
generated Interop Assembly.
VC.NET C#.NET 2003
[C++]
[
object,
uuid("FBBDA07C-B48D-4B00-A24F-BEFD7EA52118"),
dual, helpstring("ITestHash Interface"),
pointer_default(unique)
]
__interface ITestHash : IDispatch
{
[id(1), helpstring("method DoHash")] HRESULT DoHash([in] BSTR strSource,
[out,retval,satype(byte)] SAFEARRAY** abDestination);
};
STDMETHODIMP CTestHash::DoHash(BSTR strSource, SAFEARRAY** abDestination)
{
CComBSTR bst = strSource;
CComSafeArray<byte> m_bts;
unsigned int l = bst.Length();
byte bt = l;;
m_bts.Add(bt);
m_bts.Add(2);
*abDestination = m_bts.Detach();
return S_OK;
}
Add reference to the COM above will get a interop assembly for use in C#
[C#]
[STAThread]
static void Main(string[] args)
{
COMLib.ITestHash t = new COMLib.CTestHashClass();
byte[] bt = (byte[])t.DoHash("Hello");
Console.WriteLine(bt[0]);
Console.WriteLine(bt[1]);
}
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Graham Morris - 06 Oct 2005 15:39 GMT
You are using attributed C++: I had a C++ component with a separate IDL
file. The C++ component works fine with a VB6 client.
Anyway I've programmed round this problem now. (I've done what I wanted
another way). Thanks for the reply.
> Hi
>
[quoted text clipped - 47 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
"Peter Huang" [MSFT] - 07 Oct 2005 03:12 GMT
Hi
Thanks for your quickly reply!
And I am glad that you have resolved it.
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.