Having done this myself, I can attest that it works; however, it's not
something you can easily integrate into your build process for whenever
you need to re-gen your interop assembly for whatever reason.  I would
recommend using the second option in the article, and write the interop
assembly code yourself in C#.

Greg Reinacker
Reinacker & Associates, Inc.
http://www.rassoc.com
http://www.rassoc.com/gregr/weblog/

-----Original Message-----
From: The DOTNET list will be retired 7/1/02
[mailto:[EMAIL PROTECTED]] On Behalf Of Willy Denoyette
Sent: Thursday, June 27, 2002 2:13 PM
To: [EMAIL PROTECTED]
Subject: Re: How to call C++ COM object from C#


Kenneth,

Yes, there is a way to do this, but you need to hack the Interop
Assembly (IL).
Take a look at following KB article Q305990 for details:

Willy.


----- Original Message -----
From: "Kenneth Kasajian" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 27, 2002 4:43 PM
Subject: [DOTNET] How to call C++ COM object from C#


> I have the following method in a COM object that I currently call from
> another unmanaged C++ client.  Two of its parameters are as follows:
>
>     // Number of entries
>     [in] long Count,
>
>     // Array of IDs
>     [in, size_is(Count)] LONG * pList,
>
> When I import the associated TLB into C#, the size_is parameter is
gone.
> Is there a way to call this function from C# or do I have to wrap it?
>
>
> I also have another method where the parameters are like this:
>     // Number of entries
>     [out] short *pCount,
>
>     // Array of IDs
>     [out, size_is( , *pCount ) ] LONG **ppList,
>
> Can this be called from C#?
>
> If so, how?
>
> 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