Solved

Library

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Python Encoding Problem \u2013 4 114
count8 challlenge 13 143
t-sql sp_addlinkedserver possible risks 3 68
Android development question 2 35
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
The viewer will learn how to implement Singleton Design Pattern in Java.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

786 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