2

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

I have a .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.

1 Answer 1

2

#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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.