#import等效命令行 [英] #import command line equivalent

查看:95
本文介绍了#import等效命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Visual Studio和Microsoft的C ++编译器,我们有几个源文件,这些文件使用Microsoft特定的'#import'指令导入类型库.例如:

Using Visual Studio with Microsoft's C++ compiler, we have several source files which use the Microsoft-specific '#import' directive to import a type library. For instance:

#import my_type_lib.tlb

我想从源代码中删除#import,并将其替换为要通过GNU Make执行的命令行步骤.在构建过程中可以使用必要的接口定义(.idl源代码).

I'd like to remove the #import from the source code, and replace it with a command line step to be executed via GNU Make. The necessary interface definitions (.idl source code) are available during the build.

如何删除对#import的依赖关系,并替换为要通过命令行执行的专用构建工具?

How can I remove my dependency on #import and replace it with specialized build tools to be executed via the command line?

推荐答案

据我所知,没有单独的工具可以根据类型lib生成代码.

As far as I know, there are no separate tools to generate code from the type lib.

您可以执行一次#import,然后将生成的文件存放起来并作为常规源文件包含在内.但是随后对类型库的更改将需要一个新的受监督构建来重新生成文件.

You could do #import once, and then stash away the generated files and include them as regular source files. But then changes to the type library would need a new supervised build to regenerate the files.

您正在使用生成的信息的哪些部分?如果仅使用它来获取IID,接口和CLSID,并且拥有.IDL,则可以使用MIDL.EXE生成C ++表示形式.

Which parts of the generated information are you using? If you only use this to get to IIDs, interfaces and CLSIDs, and you have the .IDL, you can use MIDL.EXE to generate a C++ representation.

如果您使用包装器类(IxxxPtr),我认为您很不走运-这些是由#import产生的.

If you're using the wrapper classes (IxxxPtr), I think you're short on luck -- these are produced by #import.

这篇关于#import等效命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆