5

Possible Duplicate:
What is special about the executables compiled with Visual Studio 11 which results in that the executables cannot be executed on Windows XP?

Executables created with Visual C++11 don't run on Windows XP. The reason is that the new CRT is using functions that are not available on Windows XP. Does anyone know of any good workarounds?

Right now I'm using dumpbin.exe to find out WinAPI functions that are not available on Windows XP. Then I'm locating and redefining the CRT functions that use those WinAPI functions. Finally I'm modifying the subsystem version in the executable.

It would be a lot easier if I could redefine those new WinAPI functions and make the CRT use mine, however I'm not sure if this is possible.

Community
  • 1
  • 1
NFRCR
  • 5,304
  • 6
  • 32
  • 37
  • 4
    You would be well advised to use Visual C++ 2010 SP1 if you intend to target Windows XP. – James McNellis Mar 04 '12 at 00:40
  • It should also be noted that, as far as I know, VC2010 and VC2011 share the same project format. So you should be able to switch back and forth easily enough. – Nicol Bolas Mar 04 '12 at 02:20
  • Why not just stick with 2010 for XP projects? – 01100110 Mar 04 '12 at 03:24
  • For those who are asking why: VC++11 supports more C++11 features and I want to use them. – NFRCR Mar 04 '12 at 08:32
  • one workaround is to implement a set of wrapper functions that allow your app to run on XP. you also have to set the executable OS and subsystem versions back to 5.1 because the VC11 linker does not allow you to set anything other than 6.0 and above. You can use this workaround at my blog if you really want to do this, but use at your own risk as there are some missing functions in the wrappers, feel free to add to them though. See: http://tedwvc.wordpress.com/2012/03/11/how-to-get-visual-c-2012-vc-11-beta-statically-linked-crt-and-mfc-applications-to-run-on-windows-xp/ – Ted. Mar 13 '12 at 14:56
  • I actually did something similar before seeing your blog. Both my solution and your solution work great until the usage of threads. There's something in the PPL library that causes the process to crash on XP. Can be simulated by either using std::thread or Concurrency::task from the PPL. If I remember correct, while browsing the CRT source. I saw that they are using GetProcAddress in PPL to load some Vista+ functions. However the decision on what function to load was done at compile time. – NFRCR Mar 14 '12 at 15:15
  • @NFRCR I made a fix for the PPL library stuff as well (check 1.03 version on my blog) – Ted. Mar 16 '12 at 03:41

0 Answers0