views:

44

answers:

2

I'm working with some legacy code that has an import like so:

#import "C:\Program Files\Common Files\System\ado\msado15.dll" rename("EOF", "EndOfFile")

The problem is, on a x64 machine the path for this import is in the 'Program Files (x86)' directory. Is there a preprocessor macro I can wrap around this to make it work on either?

Edit1: I think I found it. _M_X64, but im not 100% sure if this is correct. Edit2: _M_X64 seems to be for when you are compiling FOR a x64 processor. Not on one.

+4  A: 

If you take a look at the #import statement documentation, you'll find that the search order for the (MIDL) compiler is

  1. the folders in %PATH%
  2. the folders in %LIB%
  3. all 'additional include' directories

So you can just do `#import ' and give your compiler an /I include directory.

xtofl
+3  A: 

Use the progid/libid version of the import statement...

#import "progid:my.prog.id.1.5"

or

#import "libid:12341234-1234-1234-1234-123412341234" version("4.0") lcid("9")
SDX2000
oh nice.who knew!?
Chris Becke