开发者

Win32 C++ Import path based on OS?

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

  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.


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")
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜