Issue using Visual Studio 2010 compiled C++ DLL in Windows 2000
Visual Studio 2010 cannot build binaries that run on Windows 2000. It's actually even worse than that, they won't run on Windows XP RTM or Windows XP Service Pack 1 either. This is because VS2010's C runtime library requires the EncodePointer API which is not available until SP2.
It appears you're stuck building with installing VS2008 if you want to support earlier versions of Windows. You can either move your entire project to Visual Studio 2008 or you can target the vc90 (Visual Studio 2008) toolset from within your Visual Studio 2010 projects. For more details on the latter method, see this anwser to my related question here.
Visual Studio 2010 and Windows 2000
The compatibility problem and the workaround is described in this KB article.
There is no down-conversion option to go from a .vcxproj to a .vcproj. Perhaps the changed filename extension is the strongest hint, but the project file format was changed dramatically in VS2010. The build plumbing was completely changed to support building with msbuild.exe. You'll have to recreate the project from scratch in VS2008.
Can I use Visual Studio 2010's C++ compiler with Visual Studio 2008's C++ Runtime Library?
Suma's solution looked pretty promising, but it doesn't work: the __imp__*@4
symbols need to be pointers to functions, rather than the functions themselves. Unfortunately, I don't know how to make Visual C++ spit out a pointer with that kind of name generation... (well, __declspec(naked)
combined with __stdcall
does the trick, but then I don't know how to emit a pointer).
If using an assembler at build-time is OK, the solution is pretty trivial - assemble the following code with FASM and link against the produced object file, and presto - no EncodePointer/DecodePointer references in the exe:
use32
format ms coff
section ".data" data
public __imp__DecodePointer@4
__imp__DecodePointer@4 dd dummy
public __imp__EncodePointer@4
__imp__EncodePointer@4 dd dummy
section ".text" code
dummy:
mov eax, [esp+4]
retn 4
visual studio 2012 win32 project targeting windows 2000
The runtime for the VS2012 compiler supports targetting XP, but does not support earlier versions. In fact, on release, XP targetting was not supported and that was added in a later update. If you must support Win2k, you must use the toolset from an earlier version of VS that does support Win2k.
Related Topics
Gcc 7, -Wimplicit-Fallthrough Warnings, and Portable Way to Clear Them
Qtextedit with Different Text Colors (Qt/C++)
Value-Initializing an Automatic Object
G++ Ld: Symbol(S) Not Found for Architecture X86_64
Cannot Evaluate Function -- May Be Inlined
C++ Back End Call the Python Level Defined Callbacks with Swig Wrapper
Round to Nearest Multiple of a Number
Is There Any Function Equivalent to Matlab's Imadjust in Opencv with C++
C++ Regular Expressions with Boost Regex
Getting Actual File Name (With Proper Casing) on Windows
What's the Difference Between C and C++
Can This MACro Be Converted to a Function
Create Objects in Conditional C++ Statements
How to Add Playable(Such as Wav,Wmv) Header with Pcm Data/Buffer in iOS