views:

63

answers:

3

I work on C/C++ using Visual Studio 2008. I believe that I am not concerned about which runtime libraries are being used by my code as I have the developer setup. But when the executable is shipped, the runtime libraries being used need to be shipped alongwith. Am I right?

If yes, how can I identify which shared libraries are actually getting used? Or are there any libraries that we can ship without having to know this?

A: 

Look at the generated manifest file to see which version of the CRT you need to ship with. It's possible to change which version of the CRT you link to as seen here but it doesn't seem to be recommended.

Andreas Brinck
Thanks Andreas. It was helpful.
HS
+1  A: 

you need to ship dll files with you.

you can guess most of them and for the rest you can use a program "Dependency Walker" which shows you dependencies of the executable.

ufukgun
I've heard that the dependency walker doesn't work properly since MS introduced side by side assemblies.
Andreas Brinck
It's been updated to handle side by side assemblies better. See the link in my answer.
Emerick Rogul
I think the keyword here is "better", you still can't rely on getting exact information from it. Better to use the manifest file.
Andreas Brinck
I'm not sure what you mean about not being able to rely on it for "exact information". It displays the information contained in the embedded manifest file.
Emerick Rogul
Thanks! ufukgun
HS
+1  A: 

You're correct, you need to ship a version of the C runtime libraries that matches the version you linked your application against. If you're compiling with Visual Studio 2008, then you want to use the Microsoft Visual C++ 2008 Redistributable Package. As other folks mentioned, you can inspect your application's manifest file to see exactly which version of the C runtime libraries it's linked against.

Before shipping, it's always best to install your product on a clean (i.e., non-developer) virtual machine and run Microsoft's Dependency Walker utility to verify that your application uses the correct C runtime libraries.

Emerick Rogul
Thanks! Emerick
HS
I got a test machine where Visual Studio is not installed and I have seen from manifest and also the Dependency Walker that there is dependency on Microsoft.VC90.CRT or specifically MSVCP90.dll, MSVCR90.dll.
HS
Contd..My app is a Java app running in Tomcat. It uses C++ dlls which are present in apache-tomcat/bin/build/dll. I copied all MSVC*.* dlls alongwith manifest file in this folder and later on in bin folder and then under apache-tomcat folder also. But the dependency error is still being shown when the application runs. Setting up the Path environment variable also didn't help. I was doing all this thinking that if I paste CRT dlls in working directory, dependency should get removed. Can you suggest something?
HS
You shouldn't copy the files to your application's directory; you should install the appropriate C runtime so that it's available to all applications on that computer. Use the link that I provided in my answer to install the appropriate runtime libraries.
Emerick Rogul