views:

27

answers:

1

When linking an executable, if it does not make reference to any of the symbols in one of the DLLs on the link line, will it still depend on that DLL at runtime?

To make the question concrete, suppose I am building an application from Visual Studio project foo.

Under Project Properties > Linker > Input > Additional Dependencies I have specified bar.lib, the import library for bar.dll, even though it is not required to link foo.exe successfully.

Do I still need to distribute bar.dll with my application since I have marked it as a linking dependency?

+1  A: 

No it is not required.

A import library only a library and the EXE will include only the references to functions which are used. By the way to verify this you can use DUMPBIN.EXE utility or dependencies walker (see http://www.dependencywalker.com/) which are part of Visual Studio packages. Just type DUMPBIN.EXE foo.exe /imports or open foo.exe with the dependencies walker.

Oleg