现在的位置: 首页 > 综合 > 正文

Any CPU, x86 and x64

2013年04月29日 ⁄ 综合 ⁄ 共 591字 ⁄ 字号 评论关闭

Here's what I learnt after struggling with Interop for more than half a week:

  • A 32-bit process can only load 32-bit libraries; while a 64-bit process can only load 64-bit libraries, it can not load 32-bit libraries.
  • A managed executable of Any CPU runs as a 32-bit process when it is launched in 32-bit OS, and a 64-bit process when it is launched in 64-bit OS.
  • Therefore, if I'm building an application consisting of a managed executable, a managed library and an unmanaged library, it is suggested that:
    • Target the managed library at Any CPU;
    • Target the managed executable at x86 if the unmanaged library targets at Win32; otherwise target the managed executable at x64 if the unmanged library targets at x64.

抱歉!评论已关闭.