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?

VividD
  • 10,456
  • 6
  • 64
  • 111
jcao219
  • 2,808
  • 3
  • 21
  • 22

1 Answers1

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
Eli
  • 1,315
  • 1
  • 16
  • 29