• C

difference between static/dynamic libraries

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

Regards & Thanks,
arut
arutAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.