kiriloff
kiriloff

Reputation: 26333

.lib files generated by VS2010

Working with any C++ VS2010 solution,

Upvotes: 1

Views: 60

Answers (1)

Nejat
Nejat

Reputation: 32665

The .lib file that makes the link to the DLL is called an "import library", and it is indeed a static library (albeit a special kind of static library). It is just a static library that contains an amount of code to import the DLL at load-time, in other words, it acts as the "middle-man" between your code and the dynamic library.

If you create a "static library", you end up with a large .lib file which contains all the compiled code for the functions in that library. If you then create an executable using that library, all of that code is copied into the executable at link-time. This makes a larger executable, but one that doesn't depend on a separate DLL file at run-time.

If you create a "dynamic library", you end up with a large .dll file and a small .lib, as previously described. All of the compiled code for the functions in the library is in the .dll file. Now your final executable is smaller, since the code is -not- copied into the executable at link-time, but the .dll file has to be sent along with the executable, unless you can rely on it already being correctly installed on the end-user's computer.

Upvotes: 3

Related Questions