Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Sorry for bad English.

Suppose there is a library xxx under GNU GPL, that provide a function yyy. Suppose my code links to the library and use this function. Does my code inherit GPL license?

IANAL, but my thoughts are conflicting:

  • On one hand, my code is derivative from the library, so it should inherit GPL.
  • On other hand, my code just use link to the xxx. Maybe there are other libraries, that has the same interface (particularly, they provide yyy function with same functionality, but different implementation). My code may link to any. My code really doesn't directly derived from xxx, it just use its interface. So, my code shouldn't inherit GPL.

I'm confused.

ADDED. The question is absolutely abstract. I don't mean any concrete GPL library.

share|improve this question
    
Generally yes, your code will be bound by the GPL for linking with a GPL'd library. However, there are exceptions for systems libraries. Please update your question with specifics about which library you are linking to and your question may be more easily answered. –  GlenH7 Dec 11 '12 at 16:36
    
Be careful there are subtle differences between different versions of the GPL (particularly LGPL). Which exact version of the GPL does xxx use. Preferably provide a link so we can see. –  Loki Astari Dec 12 '12 at 2:13
    
@Loki: If different versions GPL have different point of view to the question, please explain it fully as a Answer. –  Corvus Dec 12 '12 at 14:33
add comment

4 Answers

up vote 11 down vote accepted

Generally speaking, if you're using a library that is GPL'd, your application must also be GPL'd. There are few exceptions, and they most likely do not apply to you.

share|improve this answer
add comment

When you link your application to a library, you are making a derivative work of that library. Therefore, under the terms of the GPL (under which the library is licensed), you must distribute the application source code with the application (if you distribute it). And it is a derivative work whether you just link to it or if you alter the source code as well.

Where this gets fuzzy is with dynamically linked libraries. If your software can dynamically link a GPL'ed library (e.g. .dll or .so), but could also run without that library, then you could distribute your software without the library, but then tell the distributee how to run the software with the library. Because the software can run without the library, you can distribute working software without the GPL'ed library and without the application source code, and still not be violating the GPL. But it is still fuzzy.

One trick I saw a big company use a few years ago was to put a shim between the proprietary application and the GPLed library. The shim was a functionally equivalent wrapper around the GPLed library, and it was itself implemented as a dynamic library (.so). The shim was licensed with LGPLv2, so if the application linked to the shim, the application source code didn't have to be distributed. The source code of the shim "worked" without the GPLed library too, so it could be distributed under any license, so they were able to choose LGPLv2 instead of GPL. Still fuzzy.

Aparently, dynamic loading is how the one can get proprietary drivers to work on Linux.

The key in all of this is that if the entity who received the working application is able to reassemble a working application to use a GPLed library he acquired himself, then the copyright owner of the working application does not have to distribute the source code because the derivative work was made after the distribution of the application, and not before.

Still fuzzy... but I have given you more ways to look at the problem.

share|improve this answer
add comment

Obviously, this is something that technically can only be answered by a lawyer.

The longer answer is that the ambiguity is somewhat long-running, which means it would have to be decided in a court case.

To avoid any issues, many developers turn to the LGPL in order to avoid the difficulty. Even this doesn't always clear things up if you use a dynamic image-based language like Lisp or SmallTalk. In these cases, some developers include a preamble to further define the boundaries (See Franz's site for example).

share|improve this answer
    
Best answer (IMO). There is yet to be a major lawsuit regarding whether GPL applies to dynamic linking. –  K.Steff Dec 11 '12 at 20:15
add comment

First, I am not a lawyer.

Said that, my understanding of GPL is: if you do anything to a GPL'ed code, you got "infected" like it was an biological virus.

So yes, linking to GPL'ed lib will make you work GPL'ed.

For this reason, you must look for an lib with an license like LGPL (or a even more permissive license, if possible).

This is not legal advice....

share|improve this answer
    
Linking to GPL'ed lib and distributing will make that distributed code to be under GPL. As long as you do not distribute, GPL does not matter, it explicitly states it restricts only distribution. –  hyde Dec 12 '12 at 7:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.