Solved

Library

Posted on 2000-04-19
3
335 Views
Last Modified: 2013-11-08
When we create dll we end up with .lib , .dll files ,similarly the c/c++ runtime library has got .lib files( example: of their declaration is in stdio.h,iostream.h) then what is the difference between these two .lib files ?
0
Comment
Question by:r_sam_14
  • 2
3 Comments
 

Author Comment

by:r_sam_14
ID: 2733292
Please give example to explain the difference clearly
0
 

Accepted Solution

by:
mayab earned 20 total points
ID: 2733528
the following is the diffrence between them:

Static Linking
In high-level programming languages such as C, Pascal, and FORTRAN, an application's source code is compiled and
linked to various libraries to create an executable file.
These libraries contain object files of precompiled functions that are called to accomplish common tasks, such as
computing the square root of a number or allocating memory. When these library functions are linked to an
application, they become a permanent part of the application's executable file. All calls to the library functions
are resolved at link time

Dynamic Linking
Dynamic linking provides a mechanism to link applications to libraries at run time. The libraries reside in their
own executable files and are not copied into applications' executable files as with static linking.
These libraries are called dynamic-link libraries (DLLs) to emphasize that they are linked to an application when
it is loaded and executed, rather than when it is linked. When an application uses a DLL, the operating system
loads the DLL into memory, resolves references to functions in the DLL so that they can be called by the
application, and unloads the DLL when it is no longer needed. This dynamic linking mechanism can be performed
explicitly by applications or implicitly by the operating system.

Differences Between Static-Link Libraries and Windows DLLs
----------------------------------------------------------
Windows DLLs differ considerably from static-link libraries. Basic differences between the two are as follows:

Static-link libraries reside in .LIB files, which are basically collections of object files, whereas dynamic-link
libraries reside in separate executable files that are loaded by Windows into memory when they are needed.

Each application that uses a static-link library has its own copy of the library. However, Windows supports
multiple applications simultaneously using one copy of the same DLL.

Static-link libraries contain only code and data because they are stored as a collection of object files.
Windows DLLs, on the other hand, can contain code, data, and resources such as bitmaps, icons, and cursors,
because they are stored as executable program files.

Static-link libraries must use the data space of the application, whereas DLLs may (and often do) have their own
data address space mapped into the address space of the process.
0
 

Author Comment

by:r_sam_14
ID: 2735192
Thank you mayab

can you explain why stdio.h/iostream.h are packaged as static library and afxwin.h is packaged as dll.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question