onverting .tlb library produces incomplete types

  • Thread starter Thread starter Dmitry Shaporenkov
  • Start date Start date
D

Dmitry Shaporenkov

Hi all,

I am trying to use a COM library from my .NET application.
I built .tlb from .idl file and run TlbImp.exe on .tlb to
produce an interoperability assembly. During conversion,
a number of warnings are issued:
.....
TlbImp warning: Type IMyType is invalid and may only be
partially converted.
.....

In resulting assembly all types referenced in these
warnings are incomplete, some members are missed. What is
the possible reason and how to work around the problem?
MIDL compiler says nothing about these types, so I can
guess that the problem is specific to TlbImp.exe

Thanks in advance,
Dmitry
 
Hi Dmitry,

The most likely reason is that one or more of the methods in your
..ILD/.TLB is expecting a pointer to a pointer to some structure or
class (thus: an array). TlbImp will not be able to translate that to
managed types directly and use an Object instead. You may have to create
your own piece of memory in the COM runtime heap using
Marshal.AllocCoTaskMem and to marshal the structures to that memory
using Marshal.StructureToPtr.

HTH,

Dennis
 
-----Original Message-----
Hi Dmitry,

The most likely reason is that one or more of the methods in your
..ILD/.TLB is expecting a pointer to a pointer to some structure or
class (thus: an array). TlbImp will not be able to translate that to
managed types directly and use an Object instead. You may have to create
your own piece of memory in the COM runtime heap using
Marshal.AllocCoTaskMem and to marshal the structures to that memory
using Marshal.StructureToPtr.

The problem is caused by using DWORD_PTR as a parameter
in methods of interfaces in the .idl file. However,
instead of translating parameter type to Object, TlbImp
simply ignores such methods and a lot of other methods
together. I can't guess how to make it not to do this.
 
Dmitry,
The problem is caused by using DWORD_PTR as a parameter
in methods of interfaces in the .idl file.

I just tried defining an interface with a method taking a DWORD_PTR
parameter, and the typelib was successfully imported by TlbImp. The
parameter was imported as UInt32.

Which versions of Midl and TlbImp are you using? Can you provide a
repro file?



Mattias
 
Back
Top