When one should implicitly or explicitly link to a DLL and what are common practices or pitfalls?
I'm assuming you refer to linking using a .lib
vs loading a DLL dynamically using LoadLibrary()
.
Loading a DLL statically by linking to its .lib
is generally safer. The linking stage checks that all the entry points exist in compile time and there is no chance you'll load a DLL that doesn't have the function you're expecting. It is also easier not to have to use GetProcAddress()
.
So generally you should use dynamic loading only when it is absolutely required.