0

I have a dll abc.dll.but when I open it in dependency walker,I depends on the MSVCR90.dll. I want to set the property of the project such type it should be independent of that dll. How it is possible.I am using vs2008.

jiten
  • 5,128
  • 4
  • 44
  • 73
  • The C++ runtime is a hard dependency and cannot be removed. However, you can link statically to the CRT libraries (with some caveats). See http://stackoverflow.com/questions/3230/how-do-you-pack-a-visual-studio-c-project-for-release. – Frédéric Hamidi Oct 11 '11 at 11:33
  • 1
    Giving each DLL and the EXE its own copy of the CRT is almost never not a problem. Don't do this unless you know *exactly* what the ramifications are. – Hans Passant Oct 11 '11 at 12:35

1 Answers1

2

Statically link to the CRT (/MT). That will remove the msvcr90.dll dependency (by basically including the CRT inside your dll). Note that if your dll uses other dlls, their dependencies might drag msvcr90.dll and friends in after all. In such cases, you'd better off using dynamic linking.

Eran
  • 21,632
  • 6
  • 56
  • 89
  • Yes you are right.I think other dll using msvcr90.dll.but i have to remove dependency from msvcr90.dll anyhow. – jiten Oct 11 '11 at 12:24
  • You can't remove other dlls dependencies if you can't recompile those dlls. The better way to deal with it is just install the [vcredist](http://msdn.microsoft.com/en-us/library/ms235299(v=VS.90).aspx) package before your app is run (you'll find the right version in your VC installation). – Eran Oct 11 '11 at 12:37
  • In the property,Now I have use MFC static link.This option remove the dependencies but size of dll is increased and its obvious. – jiten Oct 13 '11 at 05:27