Re: Dynamic and Static Linking
From: W.Yip <[EMAIL PROTECTED]> Date: Sun, 02 Apr 2000 22:11:15 +0100 1) What is dynamic linking? Is it the 'ln' command in Linux for symbolic linking? It has nothing to do with the `ln' command. Linking in this sense is the process of combining object files and libraries into an executable. It is done by the `ld' command, which is typically invoked by the compiler `cc' (or `gcc') when building a program. See the relevant man pages. Dynamic linking is the use of shared libraries, also called dynamic objects. On a typical Unix system, shared libraries have extensions of .so, possibly followed by a version number. They can often be found in /lib or /usr/lib. Windows also uses shared libraries; they are called DLLs (Dynamic Link Libraries). A single shared library can be used (in fact, shared) among many different programs. A shared library can be changed without relinking the program; the program will automatically use the newer version. 2) What is static linking? Is that a link to libraries on your hard disk? Static linking is linking a program without using a shared library. 3) Can you give me some examples of dynamic linking (un)covered by the GPL? Is BeOS a case in example? The GPL was written before widespread use of shared libraries. Thus, it is not clear whether dynamic linking is covered by the GPL or not. In a modern Unix or Windows system, the basic system libraries are shared libraries. Since these can be reasonably considered a part of the operating system, it is likely that the system exception of the GPL applies to them (paragraph 3). The interesting cases come when somebody modifies a GPL program to use a nonstandard shared library. Are they required to distribute the sources to that shared library, or is it acceptable to merely supply a binary form of that shared library? Shared libraries are merely one point in a continuum of GPL considerations, which also includes using CORBA or some similar protocol to make remote procedure calls to other code which may only be available in binary form, or, indeed, may be run on a controlled machine accessible over the Internet and not otherwise be available in any form at all. My take on these sorts of GPL issues is that there is no answer. Because we are talking about an continuum with infinite gradations, there is no clear way to draw the line anywhere. Because we are talking about a matter of law, not science or technology, the only way to draw a line is to make an arbitrary decision. Speaking about the U.S., I believe the legislature is unlikely to make any such decision unless they are pushed to by large companies or powerful special interest groups; however, I don't know of any large companies or special interest groups who really care about GPL arcana. Therefore, if any decision is made, it will come from the court system, but court cases take a notoriously long time to complete and can easily wind up being vague and difficult to apply outside of very specific circumstances. Moreover, by the time they decide on one aspect of this issue, it is likely to be obsolete and irrelevant. So, just do what you think is right, and don't worry about it. If you are trying to hack the GPL to make a proprietary fork of somebody else's work, then you are behaving wrongly. Don't do it. Ian
Re: Dynamic and Static Linking
On Sun, Apr 02, 2000 at 10:11:15PM +0100, W . Yip wrote: > 1) What is dynamic linking? Is it the 'ln' command in Linux for symbolic > linking? > 2) What is static linking? Is that a link to libraries on your hard disk? Ian's answer was a good one, but I want to add some more points, and explain it in a lower level of detail so you can think about the implications. I would like more people to be thinking about this :-) First yet another review, but at a bit lower level. When you write a program that looks like this: #include "sqrt.h" x = sqrt(y); and then you compile it, you are using a sqrt() function defined by some other library somewhere and asking that it be included into your program. Whether you have "dynamic" or "static" linking depends on exactly when this sqrt() function gets combined with you program (and how). The simplest form is "static linking" which means that when you build your program, the compiler copies the binary text of the sqrt() function right into your program. If you distribute your program, you will therefore be distributing the text of this sqrt() function. Thus with static linking, you clearly have created a derivative work of the sqrt() function. The more modern way is "dynamic linking" which means that when you build your program, the compiler DOES NOT copy the text of sqrt() into it, it simply records a note that your program wants to use a sqrt() function and will require one at runtime. Now when you distribute your program you are not distributing the text of the sqrt() function--only a "reference" to it (a description of it so that it can be properly located later, and a list of the places in your program where it should be linked in). With dynamic linking, when your program is finally run by an end user the operating system (in particular the "link loader") will examine your program and notice that it expects to be provided with a sqrt() function. The operating system will find one, and "fix up" your program so that the notation saying a sqrt is wanted is actually transformed into a direct pointer to the text of the sqrt() program (usually by replacing the reference with a valid pointer to the function). In order to save memory, if two different programs dynamically link to the sqrt() function, only one copy of sqrt() will be loaded into memory and both programs will share that copy of it. This is how things are in the C programming world. The reason why I wanted to add more to this message is to point out that it gets worse than this, from a legal confusion point of view, because of languages like Java, and technologies like CORBA. The big advantage of dynamic linking is that if there is a bug in the sqrt() function and someone fixes it, your program automatically starts using the fixed version, because it isn't combined until runtime. With static linking the old buggy version was actually copied into your program's binary image. In Java and CORBA not only do you not copy the sqrt() function into your program at "compile time", you don't even necessarily do it at load time: the operating system (or Java interpreter) can load and unload different versions of the sqrt() function during execution. In the dynamic link case you don't actually know WHOSE sqrt() function you are going to use either. At runtime, you might use the one that you have on your computer--or you might use a totally different one one someone elses's computer that happens to be fully compatible with the one you compiled against (it has the same "function signature", meaning that it declares the same name, same return type, and same arguments). Worse still, the function you wind up using may not even be on the same computer as where the program is executing--it may be provided over some network-function-call protocol like Java's RMI or CORBA or DCOM. The program using it has effectively no information about the sqrt() function, except that one exists and will supposedly behave as expected. So the problem for the GPL and other copyright licenses is whether or not a dynamically linked program is a derivative work of the sqrt() function, who made the derivative (the program author, or the person who caused it to link), and what the implications are if there are different choices for the sqrt() function (different vendors, etc.) > 3) Can you give me some examples of dynamic linking (un)covered by the GPL? > Is BeOS a case in example? As Ian said, DLL's on windows, and .so files on Unix are dynamically linked libraries. Also, *all* Java programs are dynamically linked. Justin
Re: Dynamic and Static Linking
On Sun, 02 Apr 2000, W. Yip wrote: > 1) What is dynamic linking? Is it the 'ln' command in Linux for symbolic > linking? Programmatically, linking is the use of functions and routines resident in libraries, those ubiquitous *.so files. Instead of rewriting the basic i/o routines that every program needs, they typically use those already available in the libraries. Examples include readline, which as routines to read and process input from the command line, and Qt, which has routines to implement various graphical widgets. > 2) What is static linking? Is that a link to libraries on your hard disk? When a program statically links to a library, the actual routines of the library are incorporated into the program. With dynamic linking, only references to the routines are included. The advantage to static linking is that the user doesn't have to hunt down libraries that the program needs, they are already included. The advantage of dynamic linking is that user memory is saved by not having redundant code. > 3) Can you give me some examples of dynamic linking (un)covered by the GPL? > Is BeOS a case in example? I don't know about BeOS. The LGPL specifically allows static and dynamic linking with no restrictions. However, the GPL is pretty much silent on the matter. There have arisen two predominant views of linking with regards to the GPL. Both sides agree that the GPL places restrictions on applications that statically links to GPL code. This is because actual GPL binary code is distributed with the application. One side sees dynamic linking as being similarly restricted. Arguments cover the inclusion of header files whether or not the linking is static or dynamic. Another is that any code that links to any other code is automatically derivative. Finally, there is the argument that the source to all "modules" has to be included with the distribution, and anything that is linked to is a module. The other side disagrees. They say that dynamic linking only uses references and not actual code. Also, the derivation that results from linking is programmatical, and has nothing at all to do with copyright. Finally, they point to the fact that dynamic linking neither copies, modifies or distributes any of the libraries code. It is my opinion that neither side with reconcile with the other. It is one reason why Debian doesn't distribute KDE. -- David Johnson... _ http://www.usermode.org
Re: Dynamic and Static Linking
David Johnson wrote: > One side sees dynamic linking as being similarly restricted. Arguments > cover the inclusion of header files whether or not the linking is > static or dynamic. Whatever arguments there may be for the "restricted dynamic linking" position (including the moral issue, which I think is substantial), this one won't fly. Header files almost certainly don't have the necessary originality to be themselves copyrightable: there is a form/content merger. -- Schlingt dreifach einen Kreis um dies! || John Cowan <[EMAIL PROTECTED]> Schliesst euer Aug vor heiliger Schau, || http://www.reutershealth.com Denn er genoss vom Honig-Tau, || http://www.ccil.org/~cowan Und trank die Milch vom Paradies.-- Coleridge (tr. Politzer)
RE: Dynamic and Static Linking
Well stated! I agree. Rod Dixon, J.D., LL.M. www.cyberspaces.org [EMAIL PROTECTED] > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of John Cowan > Sent: Monday, April 03, 2000 11:09 AM > To: [EMAIL PROTECTED] > Subject: Re: Dynamic and Static Linking > > > David Johnson wrote: > > > One side sees dynamic linking as being similarly restricted. Arguments > > cover the inclusion of header files whether or not the linking is > > static or dynamic. > > Whatever arguments there may be for the "restricted dynamic linking" > position (including the moral issue, which I think is substantial), > this one won't fly. Header files almost certainly don't have the > necessary originality to be themselves copyrightable: there is a > form/content > merger. > > -- > > Schlingt dreifach einen Kreis um dies! || John Cowan > <[EMAIL PROTECTED]> > Schliesst euer Aug vor heiliger Schau, || http://www.reutershealth.com > Denn er genoss vom Honig-Tau, || http://www.ccil.org/~cowan > Und trank die Milch vom Paradies.-- Coleridge (tr. Politzer) >
Re: Dynamic and Static Linking
On Mon, 03 Apr 2000, John Cowan wrote: > Whatever arguments there may be for the "restricted dynamic linking" > position (including the moral issue, which I think is substantial), > this one won't fly. Header files almost certainly don't have the > necessary originality to be themselves copyrightable: there is a form/content > merger. I would normally agree, but consider a liberal use of inline functions, macros, etc. This is the rebut that I've normally heard. Personally, I would discount macros as "metacode", but inlines are problematic. I'm also curious about what you consider to be the "moral issue". I would consider it wrong to use code in a way the author does not want you to use it. But I have no other indication of what the author wants beyond the text of the GPL. And since it is unclear at best whether the GPL allows dynamic linking, I am left to my own guesswork. -- David Johnson... _ http://www.usermode.org
Re: Dynamic and Static Linking
On Mon, Apr 03, 2000 at 08:53:00PM -0700, David Johnson wrote: > I'm also curious about what you consider to be the "moral issue". I > would consider it wrong to use code in a way the author does not want > you to use it. But I have no other indication of what the author wants > beyond the text of the GPL. But that's not true in many cases. For instance, anything RMS wrote. And even in the cases which it is true, (something I wrote, say) you can often ask the author. Otherwise, if the author really wanted you to dynamically link and really thought about the license (written, spirit, and understood by the community), he either would have used LGPL or explicitly said you could (like Linus did), IMHO. -- David Starner - [EMAIL PROTECTED] Only a nerd would worry about wrong parentheses with square brackets. But that's what mathematicians are. -- Dr. Burchard, math professor at OSU
Re: Dynamic and Static Linking
On Mon, 03 Apr 2000, David Starner wrote: > But that's not true in many cases. For instance, anything RMS wrote. And > even in the cases which it is true, (something I wrote, say) you can often > ask the author. Otherwise, if the author really wanted you to dynamically link > and really thought about the license (written, spirit, and understood by the > community), he either would have used LGPL or explicitly said you could (like > Linus did), IMHO. In the case of RMS's own software, I know precisely what he wants. But it is not clear with most other authors. The point is, either I take the license at its face value, or I throw it out *completely*. After all, if a developer wanted to allow me to dynamically link, he could do one of several things: 1) use the LGPL which specifically grants it, or 2) use the GPL which does not specifically restrict it. -- David Johnson... _ http://www.usermode.org
Re: Dynamic and Static Linking
> > would consider it wrong to use code in a way the author does not want > > you to use it. But I have no other indication of what the author wants > > beyond the text of the GPL. "wrong to use code in a way the author does not want you to use it" Would you claim the very same for some Microsoft owned ActiveX component? Regards, -- martin // Martin Konold, Stauffenbergstr. 107, 72074 Tuebingen, Germany // KDE: The most advanced GUI for a reliable OS.
Re: Dynamic and Static Linking
David Johnson wrote: > I would normally agree, but consider a liberal use of inline functions, > macros, etc. This is the rebut that I've normally heard. Personally, I > would discount macros as "metacode", but inlines are problematic. I agree with this: C++ header files with inline functions are probably copyrightable. (I'm a C troglodyte.) > I'm also curious about what you consider to be the "moral issue". I > would consider it wrong to use code in a way the author does not want > you to use it. But I have no other indication of what the author wants > beyond the text of the GPL. And since it is unclear at best whether the > GPL allows dynamic linking, I am left to my own guesswork. I think that someone licensing code under the GPL intends the spirit of the GPL, which is surely to prevent the use of GPLed parts in unfree programs. The words of the GPL are just the means by which this purpose is achieved. -- Schlingt dreifach einen Kreis um dies! || John Cowan <[EMAIL PROTECTED]> Schliesst euer Aug vor heiliger Schau, || http://www.reutershealth.com Denn er genoss vom Honig-Tau, || http://www.ccil.org/~cowan Und trank die Milch vom Paradies.-- Coleridge (tr. Politzer)
Re: Dynamic and Static Linking
David Johnson wrote: > The point is, either I take > the license at its face value, or I throw it out *completely*. What, and put all our local lawyers (and law students) out of business? Shame. :-) -- Schlingt dreifach einen Kreis um dies! || John Cowan <[EMAIL PROTECTED]> Schliesst euer Aug vor heiliger Schau, || http://www.reutershealth.com Denn er genoss vom Honig-Tau, || http://www.ccil.org/~cowan Und trank die Milch vom Paradies.-- Coleridge (tr. Politzer)
Re: Dynamic and Static Linking
On Tue, 4 Apr 2000, John Cowan wrote: > I think that someone licensing code under the GPL intends the spirit > of the GPL, which is surely to prevent the use of GPLed parts > in unfree programs. The words of the GPL are just the means by which > this purpose is achieved. IIRC the GPL does not govern use but distribution. IMHO linking/use in a distributed component way is still an unresolved GPL problem. Yours, -- martin // Martin Konold, Stauffenbergstr. 107, 72074 Tuebingen, Germany // KDE: The most advanced GUI for a reliable OS.
Re: Dynamic and Static Linking
Martin Konold wrote: > Would you claim the very same for some Microsoft owned ActiveX component? The issue is entirely different, involving civil disobedience, not moral obligation. -- Schlingt dreifach einen Kreis um dies! || John Cowan <[EMAIL PROTECTED]> Schliesst euer Aug vor heiliger Schau, || http://www.reutershealth.com Denn er genoss vom Honig-Tau, || http://www.ccil.org/~cowan Und trank die Milch vom Paradies.-- Coleridge (tr. Politzer)
Re: Dynamic and Static Linking
On Tue, 04 Apr 2000, Martin Konold wrote: > "wrong to use code in a way the author does not want you to use it" > > Would you claim the very same for some Microsoft owned ActiveX component? Yes. If they have an ActiveX component that they had undue restrictions on, I wouldn't use it. AFAIK, Microsoft puts all of it's "wishes" in it's licenses. If I did stumble across a MS site that said, "here is our EULA, but by the way, we wish you wouldn't use this component for X, Y or Z, even though we allow you to" then I would respect their wishes. -- David Johnson... _ http://www.usermode.org
Re: Dynamic and Static Linking
On Tue, 4 Apr 2000, David Johnson wrote: > On Tue, 04 Apr 2000, Martin Konold wrote: > > > "wrong to use code in a way the author does not want you to use it" > > > > Would you claim the very same for some Microsoft owned ActiveX component? > > Yes. If they have an ActiveX component that they had undue > restrictions on, I wouldn't use it. AFAIK, Microsoft puts all of it's > "wishes" in it's licenses. If I did stumble across a MS site that said, > "here is our EULA, but by the way, we wish you wouldn't use this > component for X, Y or Z, even though we allow you to" then I would > respect their wishes. Ok, imagine a simple case: MS asks you to not use any of their components in order to figure out how their file formats are working. Are you (maybe you are a GPL Office Suite developer) accepting this?! Another example: A lot of MS programmers hate if they are bothered by insecurity news. Are you claiming that "because these authors do not want you to use their work" in order to figure out the weaknesses of their implementations you are not going to use their programs/components? Regards, -- martin // Martin Konold, Stauffenbergstr. 107, 72074 Tuebingen, Germany // KDE: The most advanced GUI for a reliable OS.
Re: Dynamic and Static Linking
On Tue, 04 Apr 2000, Martin Konold wrote: > Ok, imagine a simple case: MS asks you to not use any of their components > in order to figure out how their file formats are working. Are you (maybe > you are a GPL Office Suite developer) accepting this?! Now you're asking me to choose between the lesser of two evils! If I have the moral right to infringe upon their wishes and follow the license and the law, then it is also my moral right to infringe upon the wishes of GPL developers and read the strict letter of their license. But if I am not allowed to do something with GPLd code because of the author's wishes, then neither am I allowed to reverse engineer a component that MS doesn't want me to. > Another example: A lot of MS programmers hate if they are bothered by > insecurity news. Are you claiming that "because these authors do not want > you to use their work" in order to figure out the weaknesses of their > implementations you are not going to use their programs/components? Everything in moderation! Please! I remember it was a year ago when some indignant Debian developer said I was pretty low and scummy for saying that the GPL allowed dynamic linking. "What about what I want!" he said unselfishly and in the interest of community software. I've thought about his rude statement since then and have come to the conclusion that respecting an author's wishes is good rule of thumb, but not an absolute principle of behavior. -- David Johnson... _ http://www.usermode.org
Re: Dynamic and Static Linking
On Tue, 4 Apr 2000, David Johnson wrote: > statement since then and have come to the conclusion that respecting > an author's wishes is good rule of thumb, but not an absolute principle > of behavior. 100% agreed. Thread closed ;-) YOurs, -- martin // Martin Konold, Stauffenbergstr. 107, 72074 Tuebingen, Germany // KDE: The most advanced GUI for a reliable OS.
Re: Dynamic and Static Linking
On Tue, 04 Apr 2000, Martin Konold wrote: > Ok, imagine a simple case: MS asks you to not use any of their components > in order to figure out how their file formats are working. Are you (maybe > you are a GPL Office Suite developer) accepting this?! It was late last night when I replied to this, and I realized later what bothered me about Martin's examples. One should strive to respect the author's wishes with regards to their OWN software. It's their property. But their wishes have little influence upon MY property, namely my copy of their software. In respect to the GPL, the right to dynamically link to a library could very well be one of the rights of copyright held by the author. Then again, it might not be. I'm not so sure. If it does belong to the author, then their wishes are very relevant. Since I really don't know if it isn't, I will give the benefit of the doubt to the author. But in the case of MS and their components, I already have the right to reverse engineer by own copies of software. Their wish for me not to do so is irrelevant. -- David Johnson... _ http://www.usermode.org
Re: Dynamic and Static Linking
From: David Johnson <[EMAIL PROTECTED]> > In respect to the GPL, the right to dynamically link to a library could > very well be one of the rights of copyright held by the author. Then > again, it might not be. I'm not so sure. The only court case I know of concerning dynamic linking so far has been Nintendo vs. Golob, and it was not conclusive on this issue. Stallman's position on this last time I asked him is that dynamic linking of non-GPL objects to GPL objects is a device being used to _deliberately_ _circumvent_ the license terms, and thus a court would still hold it as infringement in the same way as if it was static linking. I assume he has advice on this from the Columbia law professor who helps him out with the GPL. But until you get a court case, you won't see a ruling on it. Thanks Bruce