The question is published on by Tutorial Guruji team.
I understand that .lib is static library linking and .dll is dynamic. This means that when .exe is produced, .lib does not need to be around for .exe to work. However, .dll need to be put in the correct relative path for .exe to reference and run.
My question is for .lib. When uploading the source code to Github, do I include .lib file in the project folder as well? What is the best practice in doing so?
Most of the tutorial that shows how to install library makes us link .lib file to its original folder and move .dll file into the working project folder. So should I move .lib file into my project folder as well? If I don’t do that, it means the person that download my source code will have to go find the corresponding .lib file to link and compile right?
My own “IMHO answer” would be: “GitHub is concerned with source code.” Therefore, I would not suggest including a binary
.lib file there. And, I probably also would not put a binary
.dll file there, either.
To clarify the difference between the two files …
.lib file is a library of object-code, resulting from previous compiles, that can now be referenced by the linker. The linker will choose whatever it needs, then copy these items out of the library into whatever it may be building at the time.
.dll is a dynamic library … “dynamic” in the sense that applications (and, other DLLs …) can load it and unload it at runtime. (The Windows program-launcher also automatically loads any DLLs that are directly or indirectly referenced by anything it is launching.)
.dll‘s are “all or nothing.” You load them in their entirety, at runtime.
.lib‘s, by contrast, are true libraries, which are used only by the linker.
=== Edit: And the next Answer, IMHO, “nailed it.”