2

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?

HS.
  • 459
  • 2
  • 6
  • 15

3 Answers3

2

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
  • 6,889
  • 8
  • 33
  • 55
2

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
  • 6,706
  • 3
  • 32
  • 39
  • 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. Dec 10 '09 at 06:18
  • 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. Dec 10 '09 at 06:19
  • 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 Dec 10 '09 at 12:37
1

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.

Community
  • 1
  • 1
Andreas Brinck
  • 51,293
  • 14
  • 84
  • 114