What programming language/compiler/libraries should I use to create an app that runs on Windows XP without any additional software?
I need to create a basic app to check the availability of components and if necessary download them to any computer running Windows XP or above. Which language (preferably free or VS 2010) should I use to create such 开发者_如何学运维an application which can run without requiring any frameworks installed beforehand?
could you please elaborate? By static library, do you mean a dll that should reside alongside the exe? or do you refer to available dlls in windows/system32? Also, will programs compiled using this method require the 'Visual C++ Redistributable'?
When C++ executable links to a static library, then the linker includes the library's object code in the same file as the EXE. The result is a single *.exe
file, and the library does not need to be shipped as a separate *.dll
.
The DLLs in windows/system32 are typically O/S files. They're O/S-specific. You may/must/do not ship/redistribute these files (Microsoft does). Your EXE (or e.g. the C run-time library to which you have statically linked) depends on (requires) some of the functions which are exported from these DLLs. These O/S DLLs tend to be backward-comptible, so that if you target the O/S API which exists on XP, your code will also run on Vista.
I'm guessing that by 'Visual C++ Redistributable' you mean "the Visual C run-time library", whose DLL filename is something like msvcrt80.dll
. This is what I talked about in my first paragraph: if you choose the build option (available under project/properties) to statically link to the C run-time library, then the code you require is statically linked into your EXE and you don't require (don't run-time link to) this DLL.
Visual C++ 6 with MFC. If you use a later version of Visual C++ then your Windows XP targets will need libraries for them.
Edit: Comments pointed out that the CRT and MFC library can be linked staticly even in later versions. That is right and I forgot.
While not specifically designed for this, I recommend InnoSetup for setup bootstrappers. It doesn't require any libraries, provides functionality for common setup requirements and has PascalScript to extend it. There are a lot of plugins available, and you can do anything left with a custom script (basically like Delphi). PascalScript can import API functions, so you can really do anything. With InnoCallback, you can even get callbacks from the API - I used this to bootstrap a lot of MSI setups into a single package using the MSI API.
If you download it, get the QuickStart Pack, which includes a good editor and the InnoSetup preprocessor.
精彩评论