C++/CLI as x64 loading x86 native library RRS feed

  • Question

  • I've checked the documentation, http://msdn.microsoft.com/en-us/library/k8d11d4s.aspx, and it makes the following terribly ambiguous statement:

    "To ensure that a safe image continues to run when it loads a 32-bit image on a 64-bit operating system, you must use /CLRIMAGETYPE (Specify Type of CLR Image) to change the metadata (.corflags), marking it to be run under WOW64. A sample command line follows (substitute your own entry symbol)"

    Is it saying that a 64bit safe app can be made to successfully load a 32 bit image, so that x64 and x86 are interoperating, or is it saying that the safe app will be downgraded to become a 32bit app, so that it can load the 32 bit image? 

    -Brent Arias
    Wednesday, November 25, 2009 8:44 PM


  • It's saying that you need to set your application to target x86, thereby being a 32bit application, in order to load a x86 binary.  Setting /CLRIMAGETYPE is basically the same as targetting x86 explicitly within Visual Studio.

    You can't have a 64bit application load a 32bit DLL.  It will not work.
    Reed Copsey, Jr. - http://reedcopsey.com
    Wednesday, November 25, 2009 9:16 PM