Suppose my code uses (simply links to) a library licensed under the GPL. Can I release my code under CC0 (public domain dedication)? Is my code affected by the copyleft nature of the GPL?

  • @Martin Beckett: Edit the question as you want, remove trolling words, etc., but keep general sense, please.
    – user55777
    Aug 1, 2012 at 15:55
  • @MartinBeckett - Just edited as you suggested. GPL-virus is not the correct term for the viral nature of the GPL. Kinda funny, but not the right term.
    – user53019
    Aug 1, 2012 at 16:03
  • 1
    @GlenH7 - yes it is a "viral" license but "gpl-virus" is a bit flame bait. There are a lot of anthropological terms for people that are correct but you wouldn't use in a bar in certain neighbourhoods! Aug 1, 2012 at 16:16

3 Answers 3


If the library is under the regular GPL, then your CC0 code cannot use it (at least according to the GPL FAQ). The main intention of the GPL is to prevent proprietary software makers from profiting from free software without giving back anything. If it were possible to put a program that uses GPL code under a license that does not require making the entire program open source, then the GPL could be trivially circumvented by writing wrapper for the GPL code that has a very permissive license.

There is a separate license, the LGPL that puts a library's code under the GPL while allowing non-GPL code to use that library.


You need to release the whole program under GPL. But nothing prevents you to release the additional source code that you wrote under CC0 as well (it is your code, you can give as many permissions on it as you wish).

However, if you distribute a binary for your software, it can only be distributed under the GPL to meet with the conditions of this license.

Similar to your situation would be an American public servant contributing to a GPL software. Their contribution is automatically in the public domain but the full software continues to be licensed under GPL. See this reference : https://www.gnu.org/licenses/old-licenses/gpl-2.0-faq.en.html#GPLUSGovAdd


If your code uses someone else's GPL (ie not LGPL) code then you have (probably) created a derived work. The only license you have to distribute the other person's GPLed work is GPL.

You cannot take their work and give it away as CC - it's not yours!

edit: If you merely wish to release you own code on it's own (eg as source) then even if that requires your users to get the GPL lib to use it, that is fine. You can do whatever you want with your code.
What you can't do is take the combination of GPL+yours and give away the result, eg a compiled program, as CC.

  • There are many different ways that once piece of code can "use" another, not all of which count as creating a derived work. Aug 1, 2012 at 15:45
  • @MichaelBorgwardt - yes but it's likely that if the OP says they are "using a library" they are creating a derived work. Aug 1, 2012 at 15:48
  • I don't want to release GPL code under CC0. I want to release only my code (my files) under CC0. All the same?
    – user55777
    Aug 1, 2012 at 15:49
  • @user14284 - ok I expanded the answer Aug 1, 2012 at 15:53
  • 3
    @Martin: except your expanded answer is now wrong. Aug 1, 2012 at 15:54

Your Answer

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