?
Solved

Library

Posted on 2000-04-19
3
Medium Priority
?
339 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 60 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
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.
Suggested Courses

770 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