tags:

views:

88

answers:

3

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?

A: 

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.

Windows programmer
Do you need libraries, even if you link the CRT statically?
OregonGhost
I don't think that's true. VS 2008 (Express) for example supports the /MT has well as the /MD compiler option, and supports using MFC in a static library or in a shared DLL.
ChrisW
@ChrisW, 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'?
Soumya92
@Soumya92: Linking MFC or CRT statically means that the code is linked into your executable, i.e. no DLLs needed. Just try it out with a blank virtual machine, if you're not sure. You need to test it anyway :)
OregonGhost
+1  A: 

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.

ChrisW
Note that VC++ Redistributable actually consists of at least three (similarly-named) DLLs, not just the CRT. Just for completeness.
OregonGhost
@OregonGhost - What are the other two DLLs: MFC, and ATL?
ChrisW
This seems perfect.
Soumya92
A: 

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.

OregonGhost
Although the question does make it sound like I am making a setup program, I am not. But thanks for the pointer anyway. Might be useful in some later project.
Soumya92
In that case, if you have one available, Delphi is a more general-purpose solution for this and also doesn't require libraries (InnoSetup is written in Delphi). It's just not particularly cheap :)
OregonGhost
I already checked it out, and at the moment I cannot afford a Delphi license.
Soumya92