Re: c code reusability
- From: Ian Collins <ian-news@xxxxxxxxxxx>
- Date: Fri, 01 Sep 2006 09:56:39 +1200
Richard Heathfield wrote:
Ian Collins said:Ah, we are talking windows, I was thinking real shared libraries :)
Richard Heathfield wrote:
Dynamic linking has its advantages, but it also has a great many
disadvantages. You have already identified one of them. Another is that
it becomes too easy to introduce fresh bugs into a previously working
program.
How so? The program can carry on using the library it was built against.
Program X uses DLL Y. DLL Y is "improved", and a bug is introduced. New
version of DLL Y, with same name as before, is installed on system. Program
X now uses buggy version of DLL Y. Program X is now buggy.
Yes, you can avoid this if you're careful. No, not everyone is careful.
And it might not even be a "bug" - it might just be a change in
functionality that breaks program X. You can find some very relevant war
stories at http://www.heise.de/ct/english/99/01/070/
I thought they added the appropriate 70s technology to fix DLL hell?
Unfortunately, on some OSs you don't have much choice but to use dynamic
linking for at least some aspects of the program (e.g. Windows system
calls almost invariably resolve to a DLL call, which is a big shame), but
you can minimise the problems by using static linking as much as
possible.
At least one OS I use (Solaris) has deprecated static linking for all
system libraries. It's way easier to fix a library bug with a patch
than it is to fix every application on the system that statically links
it.
That's fine if the system is well-managed. Indeed, it is the preferred
strategy not only in pizza parlours but also in dinosaur pens. But on
Windows, it's a recipe for disaster.
--
Ian Collins.
.
- Follow-Ups:
- Re: c code reusability
- From: Richard Heathfield
- Re: c code reusability
- References:
- Re: c code reusability
- From: Ian Collins
- Re: c code reusability
- From: Richard Heathfield
- Re: c code reusability
- Prev by Date: Re: [newbie] strcpy, strtok and strcat problem...
- Next by Date: Re: Determine where my C program core dump on solaris
- Previous by thread: Re: c code reusability
- Next by thread: Re: c code reusability
- Index(es):
Relevant Pages
|