• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

difference between static/dynamic libraries

Could someone please explain the differences between a static and dynamic library.

Regards & Thanks,
arut
0
arut
Asked:
arut
  • 3
  • 2
1 Solution
 
jhanceCommented:
With a static library, references to functions are located and resolved at link time by the linker.  Once the EXE is built these functions are included in the EXE itself and cannot be changed without rebuilding the application.  Also, a copy of all the functions are in every EXE file that uses them so extra space is required.

In a dynamic library, function references are resolved at run time by the program loader.  Here, the advantage is smaller executable size and the ability to have the application run in different environments.  The disadvantage is that it takes longer to load such a program since the functions needed must be found and loaded.
0
 
Lab_RatCommented:
Can a DOS program attempt to use these DLL's??
0
 
jhanceCommented:
What DLLs are you talking about?

You asked about static vs. dynamic libraries.  DLLs are a Microsoft Windows specific feature and are a type of dynamic library.

As far as accessing a DLL from a DOS program, you haven't given enough information on the situation to provide a good answer.  There are plaform issues to consider, the "flavor" of the program and the DLL (by flavor, I mean 16-bit vs. 32-bit), and so on.

In general, however, MSDOS does support the use of DLLs in virtually the same way as Windows does it today.  Mixing Windows DLLs and DOS DLLs is messy business and generally needs to be done using extra system calls (called "thunks") and support libraries.
0
 
Lab_RatCommented:
jhance, my question was a bit wooly, but what I meant to say was:
Could I create a dynamic library especially for a DOS program using Borland C++ V4.5. And then later get another DOS program to use the libraries contained therein?
I have no need whatsoever to mix windows/dos libraries, I'n not a sadist!
0
 
jhanceCommented:
I believe that BC++ 4.5 supports 16-bit programs and I know it will build DLLs.  So I think the answer to your last question is yes.  You can build a 16-bit DLL and use it from a 16-bit MSDOS program.
0

Featured Post

Live webcast with Pinal Dave

Pinal Dave will teach you tricks to help identify the real root cause of database problems rather than red herrings. Attendees will learn scripts that they can use in their environment to immediately figure out their performance Blame Shifters and fix them quickly.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now