From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1125fa,9f5c1c8d844fc69e X-Google-Attributes: gid1125fa,public X-Google-Thread: 111c93,9f5c1c8d844fc69e X-Google-Attributes: gid111c93,public X-Google-Thread: 10d0a1,9f5c1c8d844fc69e X-Google-Attributes: gid10d0a1,public X-Google-Thread: fcfb9,9f5c1c8d844fc69e X-Google-Attributes: gidfcfb9,public X-Google-Thread: 1025b4,9f5c1c8d844fc69e X-Google-Attributes: gid1025b4,public From: K. Bjarnason Subject: Re: DLL mess Re: "No-one gets fired for buying Microsoft" Date: 1999/09/26 Message-ID: #1/1 X-Deja-AN: 529745367 References: <37D81FE1.E90C3B1F@winkinc.com> <37e1f3e4.133419146@news.shore.net> <7slngc$toq$1@Mercury.mcs.net> X-Complaints-To: news@bctel.net X-Trace: news.bctel.net 938406694 209.53.36.104 (Sun, 26 Sep 1999 21:31:34 PDT) NNTP-Posting-Date: Sun, 26 Sep 1999 21:31:34 PDT Newsgroups: comp.os.linux.alpha,comp.os.linux.advocacy,comp.os.ms-windows.advocacy,comp.os.ms-windows.nt.advocacy,gnu.misc.discuss In article <7slngc$toq$1@Mercury.mcs.net>, les@Mercury.mcs.net says... > In article , > K. Bjarnason wrote: > > >All of which is to say, an application _does_ pick "the version it > >wants" _where such versioning is relevant_ and otherwise simply gets the > >latest version. Short of an actual DLL bug, though, the application > >should keep right on working unless its (the app's) author did something > >wrong. > > > >So what's the problem? > > What!!?? A DLL bug? No... That can't happen. No one would ever > release a DLL with bugs and then update it with another of > the same name with different bugs. For the reality-impaired, > why do you think the DLL is updated in the first place if > some operation is not changed in a way that some application > requires? That means that either the app that needs the change > is using undocumented features or the DLL was not working > as documented. Or the API provided by the DLL has been _extended_. Or the operations have been _enhanced_ (eg faster copies and searches). Or... There are any number of reasons why such a DLL would be updated _without_ being either a bugfix or a change in the manner existing applications use the DLL. Let's use a hypothetical DLL I hypothetically wrote as an example. It has one function, as follows: Function: SortArrayOfIntegers Prototype: int SortArrayOfIntegers( int array[], const size_t elements ); Required Header: "SortIntAr.h" Purpose: The SortArrayOfIntegers function takes an array of integers and sorts the contents of the array such that the contents of each element compare greater than or equal to the contents of the preceeding element. Inputs: The first parameter is the array to be sorted. The second parameter is the number of elements to sort. Outputs: The first parameter is modified in-place. Because of this, passing const arrays, or pointers to const arrays, will cause a fault. Upon successful completion, the array passed as the first parameter will be in sorted order. Resources: Given an array of N elements, the function may require allocation of temporary storage up to sqrt(N) elements, and stack space up to log(N) elements. No other storage is required. Return values: Upon completion, SortArrayOfIntegers returns zero for success or less than zero for error. The possible errors are represented by symbolic constant in the supplied header file, and they are: ERR_INTSORTARR_TOOFEW This indicates there were too few elements to sort; that is, zero or one elements. ERR_INTSORTARR_TOOMANY This indicates there were too many elements to sort. If the element is very large (>= 25% of available memory) then temporary storage overhead may become too high to sort the array. Not available on all platforms. ERR_INTSORTARR_ILLEGALSIZE This indicates that the value of the second parameter exceeded the actual number of elements in the array. Not available on all platforms. ERR_INTSORTARR_ILLEGALCONST This indicates that the array passed is a constant array and cannot be modified. Not available on all platforms. Notes: On some platforms, not all error conditions can be trapped; on such platforms, the conditions noted as "Not available on all platforms" will generally cause an application fault. So far so good. You get the header and the DLL "intsort.dll" and you use them in your application. You're currently using version 1.0, and your application works. Now I release version 2.0. Guess what? There's still only one function, it still has the same interface, it still reports the same errors under the same conditions; in short, the documentation need not change *one iota*. Hmm... so why did I release 2.0? Simple; the first version used a bubble sort. Sure, it worked, but for anything more than a handful of elements, it was *slow*. Version 2.0 uses a mergesort. Now, your application, which used the function to sort a largish array in one thread while doing initialization in another thread, stops working properly, because you were relying on the observed - but not documented - O(N^2) sort times. You knew you had plenty of time to do your other functions, because the sort took such a long time. With version 2.0, your application breaks. Why? Simple; you relied on undocumented behaviour. Since that behaviour was not documented, and therefore you cannot rely upon it to remain consistent, your design is broken - not my DLL. Voila. An updated DLL, with no bugfix, with no change in documented behavior, which any app developer using the DLL will *happily* accept as it is, without requireing them to change a single line of code to get a considerable increase in efficiency... except you, who relied upon features not documented. Now, I should cry for you why, exactly?