views:

287

answers:

0

Update: Just over six months after opening a support call to Microsoft it has been rejected, they claim it is not a bug (since the documentation doesn't explicitly say that the behaviour seen isn't the correct one). They rejected the DCR saying that since they haven't heard any complaints in the last 10 years this is obviously not an common use case.

This is a call to arms, if you have run into the same issue, please open a support call with Microsoft so they understand that it should be fixed. I know that at least someone has run into the same problem becasue I found this comment in Chrome's source code:

# Building .idl files.
# This is a total mess. MIDL needs to be run from $OPEN_DIR because it's too
# stupid to apply its include paths to a relative path like "ui/ie/bla.idl"
# (it only looks in the current dir). So we have to jump through hoops to fix
# up our relative include paths and output files.


Original question:

I have the following file structure:

  • C:\first\Foo.idl
  • C:\second\Bar.idl

Where Bar.idl contains the following line:

import "first/Foo.idl";

How can I get midl to compile Bar.idl when compiling from C:\second?

If I imported Foo.idl directly (without specifying first/) then specifying first as an additional include directory would be enough (midl /I c:\first Bar.idl) and it would find Foo.idl

Alternately if I compiled from C:\ (midl second\Bar.idl) that would be OK too.

The problem is that when compiling from within C:\second with the command line midl /I C:\ Bar.idl, I get the following compilation error:

c1 : fatal error C1083: Cannot open source file: 'first\Foo.idl': No such file or directory

It looks like midl is willing to search relative paths only if they are relative to the current directory and not to one of the specified additional include directories and uses the additional include directories only for unqualified file names, this behaviour is specific to the import keyword, using include the results are as expected.

I would like to be able to add two different additional include directories so that if I have the file on my local machine midl will take that version, otherwise it will take the file from the server (so chdiring to the root folder is not an option).

Is there a way to get around this?

related questions