Suppose I took the libstc++ implementation of a C++ standard class, and modified it (so now I have, say, a magic_vector based off of the code for std::vector).

What licensing restrictions does that imply for that file specifically and for projects using it? I'm asking about libstdc++ specifically because

  • I read here that libstdc++ is not simply GPL-licensed.
  • I see the GPL mentioned in its licensing info, but doesn't the FSF use the "LGPL" for libraries? Edit The FAQ explains that the GPL-with-exception is similar to the LGPL in some cases, so then - why not the LGPL then? What's the difference?
  • You second point is addressed two bullets down in the FAQ you link to.
    – Mat
    Oct 19, 2016 at 8:06
  • @Mat: Well, partially, but I don't quite get the nuance of that thing. See edit.
    – einpoklum
    Oct 19, 2016 at 8:56
  • @einpoklum I don't see what's unclear about gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.license.lgpl, did you miss that and read another part of the FAQ instead? If it is unclear, can you explain in more detail what part you're having trouble with?
    – hvd
    Oct 19, 2016 at 10:32

1 Answer 1


What licensing restrictions does that imply for that file specifically

GPL. You must provide the source of that file, exactly as used for building, to anybody who got the binary that includes it from you.

and for projects using it?

Only those for the file itself, as long as the file itself is a reasonably self-contained component. The gcc library exception stops the license from applying to the rest of the project.

why not the LGPL then? What's the difference?

Because the gcc library exception is more permissive. LGPL only stops at a dynamic link boundary. You can't link a C++ template dynamically, since it is instantiated directly into the compilation unit using it, so LGPL would have been exactly equivalent to GPL for libstdc++. The gcc library exception stops at the program interface even if linked statically.

  • "permits anything that can be considered normal use" - but not derivative work, like the magic_vector in my example?
    – einpoklum
    Oct 19, 2016 at 16:06
  • The license applies to derivative work. The exception makes normal use of API to not be considered derivative work. The magic_vector still is derivative work.
    – Jan Hudec
    Oct 20, 2016 at 7:18
  • Can you put that in the answer?
    – einpoklum
    Oct 20, 2016 at 8:08

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.

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