If you create a dynamic library in winblows (you have mentioned mingw so that I suppose it's winblows) you get two final files: the dll and the import library, which is an ordinary .lib. The import library is a small file which contains modules like this:

Qt Code:
  1. void MyProcInDll()
  2. {
  3. if( ModuleHandle == NULL ) ModuleHandle = LoadModule("MyDll");
  4. if( ProcInstanceOfMyProc == NULL )
  5. {
  6. if( ModuleHandle != NULL ) ProcInstanceOfMyProc = MakeProcInstance(ModuleHandle,"MyProcInDll");
  7. else error;
  8. }
  9.  
  10. if( ProcInstanceOfMyProc != NULL ) ProcInstanceOfMyProc();
  11. else error;
  12. }
To copy to clipboard, switch view to plain text mode 

A "static linking" of a dll is linking with the import library. Externals from the dll are resolved by externals of the import library. When you call an entry in the dll, a stub from the import library is called, which in turn makes sure that the dll is loaded and the entry point from the dll is got. Then it calls the entry point in the dll. It also makes sure that LoadModule() and MakeProcInstance() will be called only once (or once per entry) so that the overhead is minimal. The LoadModule() in the stub does not contain a path to the dll. Therefore:

(1) If you link statically with a dll you link with the corresponding import library.
(2) You make neither LoadModule() nor MakeProcInstance(), you simply call entries from your library.
(3) You will have LIBS directive in your profile file. The LIBS directive will reference the import library, not the dll.
(4) The dll must be on the PATH, otherwise, the LoadModule() in the stub will not find it.

Static linking is the simplest way of using a dll. Nevertheless, static linking neither allows deciding which dll to link "on fly" nor it allows unlinking the dll during the application run. If you need such things, you must do LoadModule() and MakeProcInstance() yourself and do not link with the import library. This is the "dynamic linking". With dynamic linking, you won't link your application with a dll, you will do it on the application run. Therefore, no LIBS.

Note that it's a bit different in Linux. There are no import libraries in Linux. The LIBS directive will reference a dll (a "shared object, .so). I am sure that dynamic linking is possible somehow but I have not needed it so far. That's why I don't know how