Question:
The C++ project (which compiles to a dynamic library) uses the Qt library, so the static library QtCore4.lib
added to Linker->Input ; why is also QtCore4.dll
required while using the project dll?
Answer:
The problem is that a lib
file doesn't have to contain a static library at all. In short, this file contains symbols external to the program and instructions on how to deal with these symbols. This can be an instruction to link to a dynamically linked library (DLL) or an instruction to insert pre-compiled code contained in a lib file. Qt is standardly distributed in a shared version, i.e. compiled programs require its DLL, so almost all of its lib files are just DLL link instructions. Thus, QtCore4.lib
simply gives the linker information that all the symbols listed in it must be taken from QtCore4.dll
.
To get rid of dependencies, Qt needs to be rebuilt statically.