From: Richard A Morningstar

Thanks!  Got it working!





Adam Nathan <[EMAIL PROTECTED]>@DISCUSS.DEVELOP.COM> on 04/23/2002
03:44:30 PM

Please respond to dotnet discussion <[EMAIL PROTECTED]>

Sent by:  dotnet discussion <[EMAIL PROTECTED]>


To:   [EMAIL PROTECTED]
cc:
Subject:  Re: [DOTNET] InterOp and Safearrays


No, if the input type library says:

        HRESULT MethodA([in] VARIANT saUnks);

then the output assembly should contain (in IL Assembler syntax):

        instance void MethodA([in] object marshal(struct) saUnks)
runtime managed internalcall

Adam

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

From: Richard A Morningstar

The imported interop code was:

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


This is correct?






Adam Nathan <[EMAIL PROTECTED]>@DISCUSS.DEVELOP.COM> on 04/23/2002
01:28:57 PM

Please respond to dotnet discussion <[EMAIL PROTECTED]>

Sent by:  dotnet discussion <[EMAIL PROTECTED]>


To:   [EMAIL PROTECTED]
cc:
Subject:  Re: [DOTNET] InterOp and Safearrays


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.

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.

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