COM library inconsistency

G

Guest

I have a com dll, and I add it to my VS 2005 C# project it wrap the dll in a
set of functions.
And when I'm generating the .NET wrapper dll manually by using the
TlbImp.exe, the function does not look the same.
For example:
(1) By using the add reference of the VS2005 I get the interop DLL with
function that looks like that:
void Func(int i, ref System.Array stream)
(2) By using the TlbImp.exe manually I get the interop DLL with function
that looks like that:
void Func(int i, ref byte[] stream)

Why the difference?
Can I make the VS2005 generate the interop libraries like the TlbImp.exe
does? How?
 
W

Willy Denoyette [MVP]

Sharon said:
I have a com dll, and I add it to my VS 2005 C# project it wrap the dll in a
set of functions.
And when I'm generating the .NET wrapper dll manually by using the
TlbImp.exe, the function does not look the same.
For example:
(1) By using the add reference of the VS2005 I get the interop DLL with
function that looks like that:
void Func(int i, ref System.Array stream)
(2) By using the TlbImp.exe manually I get the interop DLL with function
that looks like that:
void Func(int i, ref byte[] stream)

Why the difference?
Can I make the VS2005 generate the interop libraries like the TlbImp.exe
does? How?


VS uses the same tlbimp command but applies the /sysarray switch (see tlbimp /?).
Check the msdn docs for details about this switch and the marshaling of SAFEARRAY's.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top