In my understanding, the GPL prohibits static linking from non-GPL code to GPL code, but permits dynamic linking from non-GPL code to GPL code. So which is it when the code in question is not linked at all because the code is written in an interpreted language (e.g. Perl)?

It would seem to be too easy to exploit the rule if it was considered dynamic linking, but on the other hand, it would also seem to be impossible to legally reference GPL code from non-GPL code if it was considered static! Compiled languages at least have a distinction between static and dynamic linking, but when all "linking" is just running scripts, it's impossible to tell what the intent is without an explicit license!

Or is my understanding of this issue incorrect, rendering the question moot? I've also heard of a "classpath exception" which involves dynamic linking; is that not part of the GPL but instead something that can be added on to it, so dynamic linking is only allowed when the license includes this exception?


3 Answers 3


As for specific question regarding interpreted languages, GPL FAQ is very clear:

The interpreted program, to the interpreter, is just data; a free software license like the GPL, based on copyright law, cannot limit what data you use the interpreter on. You can run it on any data (interpreted program), any way you like, and there are no requirements about licensing that data to anyone.

As for generic question about dynamic vs static linking. First of all, FSF's and Stallman's view is that it doesn't matter if linking is static or dynamic, GPL infects either way. From FSF GPL FAQ:

If the program dynamically links plug-ins, and they make function calls to each other and share data structures, we believe they form a single program, which must be treated as an extension of both the main program and the plug-ins. This means that combination of the GPL-covered plug-in with the non-free main program would violate the GPL.


Linking [name of your program] statically or dynamically with other modules is making a combined work based on [name of your program]. Thus, the terms and conditions of the GNU General Public License cover the whole combination

However, this is questionable from legal point of view. In the only case that actually went to court regarding dynamic linking — Galoob v. Nintendo — Court of Appeals ruled that derivative work "must incorporate a portion of the copyrighted work in some form". Which is not the case with dynamic linking.

Anyway regardless if dynamic linking does indeed infect or not, there is work around. It's used for example by Nvidia to provide binary drivers for Linux. You create (L)GPL wrapper, but as author you are allowed to add special exception to link with specific closed-source. Vide FSF GPL FAQ.

  • 1
    Creating an LGPL wrapper for a GPL library may allow you also to claim copyright on the combined work, but it absolutely does not give you the right to change the terms under which the original code was licensed. The original authors still hold copyright on the combined work, and they have to give permission if you want to add license exceptions.
    – the paul
    Commented Sep 26, 2013 at 22:37
  • 3
    @thepaul: there already is a legal precedence which states that at least a part of copyrighted work must be included in a work to constitute derivative work. Beliefs of Stallman often have very little foundation in actual real law.
    – vartec
    Commented Sep 30, 2013 at 19:50
  • 1
    @thepaul: on one side you have legal practice used by 9 billion dollars company, on other claims by guy who likes to wear tinfoil hat. You claim that the later is more reliable, and you're entirely in your right to believe so.
    – vartec
    Commented Jan 12, 2014 at 16:08
  • 2
    You quote the wrong part of GPL FAQ is very clear. The part you quote is about If a programming language interpreter is released under the GPL, does that mean programs written to be interpreted by it must be under GPL-compatible licenses?! Hence the to the [GPL-licensed] interpreter. The relevant part is the last 2 paragraphs: [...]Another similar and very common case is to provide libraries with the interpreter which are themselves interpreted. For instance, Perl comes with many Perl modules[...] Commented May 18, 2015 at 8:40
  • 1
    «The interpreted program, to the interpreter, is just data; a free software license like the GPL, based on copyright law, cannot limit what data you use the interpreter on. You can run it on any data (interpreted program), any way you like, and there are no requirements about licensing that data to anyone.» This is about running programs in any license even of a GPL interpreter right? Which doesn't cover the topic of using a non-libre plugin in a GPL program in an interpreted language.
    – tuxayo
    Commented Jun 25, 2018 at 10:08

Note: this is a legal question. Programmers.SE is not a legal forum, it's a programming forum. While the people here know quite a bit about programming, they don't know anything about the law. If you want to ask a legal question, you should ask that in a legal forum, where there are people who actually know something about the subject matter.

The GPL doesn't say anything about static or dynamic linking. It doesn't even say anything about linking at all. Every lawyer or judge I talked to says that the issue of static and dynamic linking is completely irrelevant.

Copyright is about creativity. Static vs. dynamic linking is a technical implementation detail. Whether or not something is statically or dynamically linked is not a creative act, it cannot possibly change the copyright status of a work.

In your question, you talk about "interpreted languages". But that term doesn't make sense: there is no such thing as an interpreted language. A language is an abstract set of mathematical rules and restrictions. A language isn't interpreted or compiled. A language just is. The term "interpreted language" is not just wrong, it is non-sensical. If English were a typed language, it would be a type error.

Interpretation and compilation are traits of the interpreter or compiler (duh!), not the language. Every language can be implemented with an interpreter, and every language can be implemented with a compiler. Most languages have both. Most modern language implementation even combine both in a single execution engine.

The Rubinius Ruby Implementation, for example, contains a static ahead-of-time compiler which compiles Ruby code to Rubinius byte code, an interpreter which interprets Rubinius byte code, and a dynamic just-in-time compiler which compiles Rubinius byte code to LLVM IR, which the LLVM infrastructure in turn compiles to native machine code. The MacRuby Ruby Implementation doesn't contain an interpreter at all, it compiles Ruby code straight to LLVM IR, then further to native machine code.

On the other hand, there are interpreters for C or C++.

All of this is just technical details. It is completely irrelevant to copyright.

It just doesn't make sense that whether or not someone violates someone else's copyright depends on whether or some third person chooses to run the program with an interpreter or compile it first.

The question is whether or not a work is derived from another work. It can be dynamically linked and still be derived, and it can statically linked and not derived at all.

  • What about interpreted "intermediate-code" languages? One of the principles behind the GPL is that anyone should be able to adapt the program to any reasonable machine which has the same language tools available as the original. If someone releases source code for an intermediate-code interpreter, along with a bunch of intermediate-form code that it can run, what would be the rules for releasing information related to that intermediate-code blob? Unlike compiled executables, which are machine-specific, the intermediate-code blob would be fully portable.
    – supercat
    Commented Oct 6, 2012 at 23:37
  • Sorry; I was going to ask on stackoverflow.com, and it suggested I ask here instead when I used the tag "gpl"! Is this sort of discussion banned here too? exec("killall -9 lawyer"); :D
    – ekolis
    Commented Oct 8, 2012 at 20:34
  • And yes, I agree that is makes no sense that an implementation detail should have no effect on the legal status of reuse; I just thought there was such a distinction and was asking for clarification!
    – ekolis
    Commented Oct 8, 2012 at 20:35
  • 4
    @ekolis: it's not banned, per se. It's just that it's not a good idea to ask legal questions of people who don't know anything about legal issues (like programmers, for example), when there are people who do know about legal issues (aka lawyers) you could ask instead. I have nothing against lawyers, quite the opposite. But I wouldn't ask one for algorithm advice, and neither would I ask a programmer for legal advice. Commented Oct 8, 2012 at 20:46
  • IANAL: It may be a technical detail, but it still makes a big difference, because it changes what is being distributed in a legally-significant way. With static linking, you're building a combined work which, according to the rules of the GPL, cannot be distributed outside the GPL. With dynamic linking, you might be doing this as well, e.g. if you package the libraries with your software in a ZIP file. But with dynamic linking, you can distribute it without the libraries, and it's 100% your work, even if it doesn't work on its own. And you can still, of course, offer the libraries under GPL.
    – Sparkette
    Commented Sep 8, 2019 at 4:48

No idea how much truth there is in this, and IANAL, etc.; but in my interpretation, what is important is whether the library you link against is is in some form included in the "binary" (where "binary", in the case of dynamic programming languages, is just the source code as distributed; this is what I make of the FSF's definition of "binary" in this context).

So if you reference libraries from your code without including them in your distribution, I would consider this the equivalent of "dynamic linking", whereas if you bundle the libraries with your product, or copy-paste parts of the library into your own code, the "static linking" scenario would apply. This, at least, is in the spirit of the GPL: you can freely use (run, inspect, reference) the GPL'd software without restrictions, but as soon as you derive from it (by linking or copying parts of it into your own distributable product), it goes viral, and your software must also be GPL'd.

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