I'm not an interop-expert, but I think this is not possible.

.Net uses typelibs for interop and typelibs can only marshal
automation-compatible interfaces. This is not specific to .NET - when
you try to use your TLB from a COM-Client you'll see that the sizeof
disappears there as well.

Use a SafeArray instead and you're on the right track - however there
*might* be a way to let the marshaller handle this, but I fear there
isn't.

HTH
        Axel

-----Original Message-----
From: Kenneth Kasajian [mailto:[EMAIL PROTECTED]]
Sent: Donnerstag, 27. Juni 2002 16:44
To: [EMAIL PROTECTED]
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.

Reply via email to