So I have a project that compiles and runs great on Windows 8 with Visual Studio 2010.
My problem is that when testing the application on a VMware Windows XP machine it crashes.
So faded in the back of my mind I think I remember a nice little code to make the exe standalone and executable on old and new versions of Windows.
I think its something like. #ifndef WINVER >= SOMETHING
I have set the Runtime Library to Multi Threaded "/MT".
Am sure someone here as had the same issue but I can`t find any thing on Google.
Help is much appreciated.
Have you made sure that all of the DLL files you are linking against are the same version? Do we get to see any feed back from the debugger? Is anything popping up on Event Viewer (or whatever it is called in Win 8)?
The data you have here tells cl to compile for Win XP SP 1 so I doubt that the issue is in this file. The program is probably trying to call a function that has changed some thing between the DLL is was compiled against on Win 8 and the DLL it is trying to link to in Win XP. This my friend is called DLL Hell for a very good reason: http://en.wikipedia.org/wiki/DLL_Hell
The easy way to confirm my theory would be to compile your code on the XP VM and see if it still crashes. This doesn't solve the issue but it narrows down the problem.
If the function might not exist in the DLL module—for example, if the function is available only on Windows Vista but the application might be running on Windows XP—specify the function by name rather than by ordinal value and design your application to handle the case when the function is not available, as shown in the following code fragment.
In Visual Studio 2010, if you develop on Windows 7 and older it will work on almost all OS except from obvious OS like MS-DOS but on Windows 8, as a development environment - it is best to use VS2012 as it contains XP target.
I had the same idea, i found this as well.
Can this be a sulution to the problem?
No. If you run the program in an unsupported version of windows you will get "The procedure entry point XXX cannot be found in DLL" error message and it will not run at all.
In this case is is 100% an error in application code.
Install a debugger and see exactly where the application crashes.
@ modoran: That depends on the DLL doesn't it? I had a similar issue to the one OP is describing when I updated MingW. Now if I try to run one of my older binary's without recompiling it the application will crash because it was linked against an older version of "libstdc++-6.dll".
@Computergeek01: No I did check that btw I will try the the tips from OrionMaster compiling on WIndows 7. But I would like to learn how to solve a issue like this. So I will continue researching the subject. Also I try using the XP (v110_xp) platform toolset in VS 2012 but that failed as well.
I try compiling under WIndows 7 and it stile don`t work.
Can the Function GetProcAddress() or GetModuleHandle() be different in WIndows XP?
Am getting this message in Dependency Walker.
00:00:00.140: GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsAlloc")
called from "c:\..\OFFICE BOX.EXE" at address 0x004040CE and returned NULL by thread 1.
Error: The specified procedure could not be found (127).
00:00:00.140: GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsGetValue")
called from "c:\..\OFFICE BOX.EXE" at address 0x004040DB and returned NULL by thread 1.
Error: The specified procedure could not be found (127).
00:00:00.156: GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsSetValue")
called from "c:\..\OFFICE BOX.EXE" at address 0x004040E8 and returned NULL by thread 1.
Error: The specified procedure could not be found (127).
00:00:00.156: GetProcAddress(0x7C800000 [c:\windows\system32\KERNEL32.DLL], "FlsFree")
called from "c:\..\OFFICE BOX.EXE" at address 0x004040F5 and returned NULL by thread 1.
Error: The specified procedure could not be found (127).
GetProcAddress(0x7C900000 [c:\windows\system32\NTDLL.DLL], 0x00000000)
called from "c:\..\OFFICE BOX.EXE" at address 0x0040203D and returned NULL by thread 1.
Error: The parameter is incorrect (87).
Ok I solved the problem on way its crashing turns out that modoran was very much right on the spot.
I had a error in my code where I was delivering a empty char array instead of the Function name string it was supposed to get. Thank you so much for your help even thou the problem was less complex then first thought.
Its worth mentioning that am now compiling on WIndows 7 as well, but it was definitely the empty char* that made it crasher. But I will not try compiling on WIndows 8 again I will update the results later
Just shows how bad error handling on my part can lead to "extra" debugging.