How to convert .tlb file to headers and implementation files?

I am trying to convert mscorlib.tlb. It is commonly used in C ++ as follows:

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

How to 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 created a .tlh file. Shouldn't there be implementation files?

+6
source share
1 answer

You can separate implementation and definition using the "no_implementation" and "implementation_only" parameters in #import. They generate .tlh files (type library header) and .tli files (library type).

I usually put the following in a header file (e.g. stdafx.h):

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

And the following to the .cpp file (e.g. stdafx.cpp):

 #import "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorlib.tlb" implementation_only 
+6
source

Source: https://habr.com/ru/post/891252/


All Articles