Aakanksha Hulkur wrote:
> Hi,
> 
>    I have 2 basic questions regarding Library creation in c++.
>  
>     * What is the difference between static and dynamic libraries.
>     * What is the mechanism behind dynamic dll's (as i get .lib and .dll 
> files after building the dll project)
> 
> your help will be appreciated, Thanks in advance.
> 
> regards,
> aakanksha hulkur.

A static library means the code will be linked into the final target 
executable (which could also be a dynamic library).  Typically creates a 
larger executable.  A dynamic library is a separate file providing 
functionality via function exports.  Dynamic libraries allow an OS to 
only load code into memory one time and then efficiently map the pages 
of the code being used into the target process on an as-needed basis.

The .lib file you get from building a DLL (.lib + .dll) is simply a 
convenience so that the linker knows what exports the DLL has and how 
many parameters each function accepts (for the last-minute sanity check) 
that will be imported.  You will notice that the .lib file is rather 
tiny in comparison to the DLL.  Opening it up in a hex editor should 
basically show all the functions you are exporting from your DLL.

Under *NIX, dynamic libraries typically have the file extension of .so. 
  Slightly different implementation but not too different.  Windows DLLs 
are much more versatile (but still not the greatest approach).

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to