Solved

Library

Posted on 2000-04-19
3
332 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

705 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now