Is there any way to build a VC++ project so that the dll/exe created by it will work as a 32 bit application on a 32 bit Windows OS and as a 64 bit application on a 64 bit Windows OS (not in WOW64).
I know that is possible for C# applications using the /ANYCPU option.
From the BUILD menu in Visual Studio, select Configuration Manager. From the Active solution platform drop-down list, select New. The New Solution Platform dialog displays. In the Type or select new platform combination box, select x64.
From the Visual Studio menu, choose Test, then choose Processor Architecture for AnyCPU projects. Choose x64 to run the tests as a 64-bit process.
Visual Studio 2022 is 64-bit Visual Studio 2022 on Windows is now a 64-bit application. This means you can open, edit, run, and debug even the biggest and most complex solutions without running out of memory.
The CLR has special loader support for the /ANYCPU option.
If you really want to do this for native, the best way to do it is to:
This is how the Sysinternals tools work (download Process Explorer onto a 64-bit machine and run it: you'll see that it writes procexp64.exe to disk and then runs it from there). It's a hack, but it works.
Not AFAIK - the problem is that
The best you could do for an .EXE was to ship a 32-bit .exe that checks if it's running WOW64 then spawns the 64-bit version instead. I can't think of an equivalent trick for libraries, though - it has to match the bits of the host process to load in the first place.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With