I am currently adding some functionality to a popular open source project. It written in C and in Every file GPL license text is embedded. The functionality I am adding is not supported by the project. So you can say its some sort of extending.

My code gets compiled when the main project is compiled. My code is inside the main project and its integrated heavily.

Let me explain more thoroughly. Basically I know of two types of linking.

  1. My program uses mysql c api. so I link my c code with libmysqlclient. Here I am using libmysqlclient

  2. My code adds hash-table functionality on libmysqlclient so user can access fields by column name.

My project is of second type. Should it be GPL? What about the first scenario (I am curious)?

  • My understanding is that the type of linking matters. Are you statically or dynamically linking to the GPL'd project? – Thomas Owens Jul 19 '12 at 16:54
  • For case 1, its dynamic linking for sure. And for my project (case 2) I dont know. I compile the main project and my source gets compiled. May be its static linking. – Shiplu Mokaddim Jul 19 '12 at 16:57
  • @ThomasOwens: For LGPL, yes; the rules on dynamic linking are more relaxed. For GPL, no; linking is linking. – Mason Wheeler Jul 19 '12 at 17:02
  • @MasonWheeler Debatable, according to Wikipedia. I tried to parse some of the references, but I'm no where near familiar enough with the nuances of the law to do so. Although I would suspect someone who is more familiar with GNU and using the GLP would be. – Thomas Owens Jul 19 '12 at 17:49
  • The GPL only applies of you re-distribute it. If it is for personal use then no problems. – Martin York Jul 19 '12 at 18:46

Yes. The GPL is a viral license; anything you extend the project with, or even link to it with shared libraries, must either be GPL or a compatible license, which includes many but not all other open-source licenses.


In case (2), where you have actually added code to an existing GPL'ed project, the GPL is very clear that you are creating a derived work, which is subject to the GPL.

In the case of (1), there is some disagreement about whether or not linking to a GPL library obligates you to license your product under the GPL. Personally, I am of the mind that you can do whatever you want by linking to a GPL library. It seems to me that in this case, you are simply making use of the library, not creating a derived work.

However, it is also good to know that there is another license called the "LGPL" which specifically states that you are not obligated to license a product under the GPL as a result of linking to an LGLP library.

  • I also think case 1 is just using the library. It should not be GPL. The main project is 100% GPL. So I can not think about LGPL. – Shiplu Mokaddim Jul 19 '12 at 17:00
  • You're going to have to read the license yourself and use your best judgement in case 1. In case 2 though, I think it's very clear that you are creating a derived work. – Vivian River Jul 19 '12 at 17:39
  • 1
    The FSF takes a specific position on this. In short, if you link to GPL'd code, your code has to be GPL-compatible, and the whole combination is automagically GPL'd. That strikes me as a little weird, but since they hold the copyright to (e.g.) GNU Readline, it's probably a good idea to at least be aware of this interpretation. – Kevin May 2 '15 at 19:38

Your Answer

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

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