I wrote a library that I want to release under the GPL to prevent it from being incorporated in closed source software.

I do not want people to use this library in their closed source commercial project.

At the same time I do not want to prevent people from using this library in any plugins they might create for closed-source software, for as long as the plugin itself is released as open source. Essentially I want plugins to be treated as separate units, for as long as they are not distributed together with the host application.

Is this achievable by using the GPL and adding an exception? More importantly, are there existing projects licensed like this? Is it at all feasible to define the plugin-host separation in a defendable way?

Example situation: The library is for scientific use. I don't want companies who are in the same business to integrate it into their product that they sell to research labs. But at the same time I do not want to make it more difficult for other researchers to use this library in conjunction with proprietary scientific software such as MATLAB or Mathematica.

  • So far this is a theoretical situation, turning this question around. It was simply easier to phrase it in a direct way.
    – Szabolcs
    Aug 6, 2015 at 16:32

2 Answers 2


Yes, you can achieve your goal with the GNU GPL, except for prohibiting commercial use. Section 7 of the GNU GPL states that you may add "additional terms" as long as they do not restrict the rights granted by the GNU GPL.

In your case, you want to grant an additional exception from the conditions in the GNU GPL or at least clarify your point of view. So instead of just saying

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

you would add something like this right after this statement:

As a further permission, you may use this program in a plugin for a program covered by an incompatible license as long as the plugin itself is released as free software covered by one of the free software licenses listed here http://www.gnu.org/licenses/license-list.html.

It is best to differentiate the software you want to allow combinations with by license instead of referring to it directly as free. That way, you have a specific list of licenses that you want to allow which makes it easier for anyone receiving your software and also is clearer in a legal sense because you do not need a possibly lengthy definition of free vs. non-free. As an alternative, you could say something along the lines of

as long as the plugin itself is released as free software as defined by the Free Software Foundation.

But I think this may be tricky legally.

If you use the exception the way I described it, someone could use your code in a program covered by the Apache License 2.0. This combined work could not be made non-free because only your exception to the conditions of the GNU GPL allow your code to be used in a combined work covered by a more permissive license. If you do not want to allow use in any free program, you need to restrict the list of allowed licenses. For example, you could say

As a further permission, you may use this program in a plugin for a program covered by an incompatible license as long as the plugin itself is covered by a compatible license.

If you want to disallow distribution of the plugin together with a non-free host application, you need to add another statement:

This additional permission does not apply to distributing this program together with a program covered by an incompatible license.

However, this last statement may be not enforceable depending on how the distribution works. If the plugin and the host program are in the same package, but the user has to load it into the host application, your exception may still apply.

Any of the additional permissions may be removed by anyone distributing your software, though (also section 7 of the GNU GPL). In that case, the program could only be used under the pure GNU GPL.

There is no way to restrict commercial use with any Free Software license. Commercial use is part of the four freedoms, so as soon as you prohibit commercial use, your software becomes non-free. Furthermore, the GNU GPL does not allow such further restrictions; those further restrictions are considered void.

The FSF also has a FAQ entry about when exactly using a plugin constitutes a combined work.

By the way, these statements also apply to the GNU AGPL which may be a good pick if you think your software may be run as a service over a network.


As I understand the GPL, it would be more restrictive than you desire. The situation of 'closed-source linksTo openSourcePlugin linksTo yourLibrary' would, I believe, look like 'linkage' in the eyes of the GPL. If you use LGPL, then you have the opposite problem.

Of course, since you own the copyright, you can choose to selectively enforce your rights -- though different opinions have been expressed on this site as to the wisdom of that idea. And if you publish your intention to do so, you may be opening yet another can of worms.

If you really want a legally sound license that applies this set of terms, you'll need to find legal assistance to draft it.

Keep in mind that, as I understand it, the FSF's goal is not to help people prevent commercial use, but to encourage the production of ever more free software. So I wouldn't, in particular, look for any assistance from that quarter.

  • 1
    Doesn't the Linux kernel also have some sort of exception in its license, since programs running on Linux are "linking" to the kernel? I don't know how that works exactly though.
    – Szabolcs
    Aug 6, 2015 at 20:26
  • TLF simply disagrees with the FSF about the definition of linkage. Under their definition, the GPL permits what you want to prevent, I think.
    – bmargulies
    Aug 6, 2015 at 20:28
  • What does TLF mean?
    – Szabolcs
    Aug 6, 2015 at 21:09
  • @Szabolcs I assume the Linux Foundation
    – Zizouz212
    Aug 6, 2015 at 23:02
  • That's TLF; the linux foundation.
    – bmargulies
    Aug 7, 2015 at 1:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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