Suppose there is a library xxx under GNU GPL, that provides a function yyy. Suppose my code links to the library and uses 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 uses link to the xxx. Maybe there are other libraries, that have the same interface (particularly, they provide yyy function with same functionality, but different implementation). My code may link to any. My code really isn't directly derived from xxx, it just uses its interface. So, my code shouldn't inherit GPL.

I'm confused.

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

  • 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.
    – user53019
    Dec 11, 2012 at 16:36
  • 1
    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. Dec 12, 2012 at 2:13
  • @Loki: If different versions GPL have different point of view to the question, please explain it fully as a Answer.
    – user55777
    Dec 12, 2012 at 14:33

4 Answers 4


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.

  • 1
    Please substantiate your claim with references.
    – rinogo
    Mar 2, 2020 at 19:29
  • Read the license. Mar 2, 2020 at 19:31
  • You're not even trying. At least include a link to the license.
    – rinogo
    Mar 2, 2020 at 19:35
  • This is the first match in a Google Search for "GPL". Mar 2, 2020 at 19:36

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.


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).

  • Best answer (IMO). There is yet to be a major lawsuit regarding whether GPL applies to dynamic linking.
    – K.Steff
    Dec 11, 2012 at 20:15

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....

  • 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, 2012 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy