You shouldn't be modifying the signature in this case because you're
treating a single VARIANT (that should contain an array of VARIANTs) as
an array of VARIANTs.  You should be able to leave the imported Interop
assembly alone and still use the C# code you have below.

-----Original Message-----
From: Rick Morningstar [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, April 23, 2002 9:44 AM
To: [EMAIL PROTECTED]
Subject: [DOTNET] InterOp and Safearrays

From: Richard A Morningstar


I have a legacy COM Object with a signature like te following:

HRESULT MethodA([in] VARIANT saUnks);

Where this variant is a SafeArray of Variants (where each variant in the
SafeArray is of type VT_IUNKOWN).


I have modified the generated Interop assemblyas follows based on info
on
this list and books, but can't quite get it to work:

MethodA([in] Object[] marshal(SafeArray Variant) saUnks) ...;


My C# client code looks as follows:

Object[] sa;
sa = new Object[1];
sa[0] = new UnknownWrapper(SomeComInterOpObject);

obj.MethodA(sa);

The legacy COM object looks at the vt field in the input parameter to
check
the type passed, and this field seems to be random garbage.

Any ideas?

Thanks!
Rick

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.

Reply via email to