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

Re: onverting .tlb library produces incomplete types by Dennis

Dennis
Mon Sep 15 08:10:22 CDT 2003

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

Dmitry Shaporenkov wrote:
> 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
>


--
Dennis Doomen
Sioux T.S.O. Netherlands

dennis.doomen@sioux.nl


Re: Converting .tlb library produces incomplete types by Dmitry

Dmitry
Mon Sep 15 11:43:06 CDT 2003


>-----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.


>
>HTH,
>
>Dennis
>
>Dmitry Shaporenkov wrote:
>> 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
>>
>
>
>--
>Dennis Doomen
>Sioux T.S.O. Netherlands
>
>dennis.doomen@sioux.nl
>
>.
>

Re: Converting .tlb library produces incomplete types by Mattias

Mattias
Tue Sep 16 16:30:45 CDT 2003

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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.