开发者

Define a struct in a midl generated header file

I am in the process of automating the build of a legacy product and have hit a wall...

I have a开发者_JAVA技巧 .idl file that is compiled in VC++ 6.0 using midl to generate a .tlb, .h and .c file that has a manual build step to add:

struct StructDef;

Just ahead of an MIDL_INTERFACE in the generated .h file. The rest of the .h file uses the definition, and I cannot compile until this is added.

I am looking for a way to autogenerate the header file with the struct definition (preferred), or at least a way to automate this code adding step through a custom build step.


#pragma midl_echo instructs MIDL to insert an arbitrary piece of text into the generated header file. You can use it like this:

#pragma midl_echo("struct StructDef;")

It appears that the cpp_quote attribute provides similar functionality.

Alternatively, if you have Cygwin installed, you may find it simpler (or just preferable) to post-process the header file with sed in a custom build step. That would work as well.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜