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")
开发者_StackOverflow中文版
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.
If you take a look at the #import
statement documentation, you'll find that the search order for the (MIDL) compiler is
- the folders in %PATH%
- the folders in %LIB%
- all 'additional include' directories
So you can just do `#import ' and give your compiler an /I include directory.
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")
精彩评论