How do I convert a .tlb file to headers and implementation files?
Asked Answered
F

1

9

I'm trying to convert mscorlib.tlb. It normally used in C++ like this:

#import "mscorlib.tlb" raw_interfaces_only              \
     high_property_prefixes("_get","_put","_putref")        \
     rename("ReportEvent", "InteropServices_ReportEvent")

How can I convert it to headers and implementation files?

I was able to use Visual Studio to compile a dummy cpp file that contained the lines above, and it produced a .tlh file. Shouldn't there also be implementation files?

Foiled answered 23/6, 2011 at 22:12 Comment(1)
Up vote - told me how to get rid of the warnings for ReportEvent.Gesner
G
10

You can split implementation and declaration by using the "no_implementation" and "implementation_only" parameters to #import. These generate .tlh (type library header) and .tli (type library implementation) files.

I typically put the following into a header file (like stdafx.h):

#import "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorlib.tlb" no_implementation

And the following into a .cpp file (like stdafx.cpp):

#import "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorlib.tlb" implementation_only
Gesner answered 17/8, 2011 at 22:46 Comment(1)
I believe you ment implementation and DECLARATION .... not definition.Franglais

© 2022 - 2024 — McMap. All rights reserved.