开发者

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

开发者 https://www.devze.com 2023-03-14 20:41 出处:网络
I\'m trying to convert mscorlib.tlb.开发者_StackOverflow中文版 It normally used in C++ like this:

I'm trying to convert mscorlib.tlb.开发者_StackOverflow中文版 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?


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
0

精彩评论

暂无评论...
验证码 换一张
取 消