I wrote a C++ library (that compiles to a dll that can be called in C#).

I would like it so that the library itself can never become proprietary but can be used in proprietary applications. If the proprietor makes any changes to the library code they have to publish only the code for the modified library and nothing else.

Which license would be suitable for this?

  • I can't quite tell whether you have written this code, or not. Could you clarify? Because if you're not the creator, you're probably not the rights-holder, in which case you may well not have the power to relicense it.
    – MadHatter
    Dec 2, 2015 at 12:43
  • I wrote the code yes.
    – OmniOwl
    Dec 2, 2015 at 12:44
  • @Vipar I can't parse "I wrote some code that is used to compile a library from C++ that can (currently) be utilized in C#". Want to pop in to chat (chat.stackexchange.com/rooms/25118/the-bikeshed ) so we can work on clarifying your phrasing?
    – Martijn
    Dec 2, 2015 at 13:07

1 Answer 1


If you want the code never to become propriety, you can use a copyleft license.

If you don't want to force programs that use your library also to become open source, you're looking for weak copyleft. These licenses ensure that adaptations of the library must be published under the same license as the original library.

The most used weak copyleft licenses are the Lesser GNU Public License (LGPL) and the Mozilla Public License (MPL).

The LGPL works on the "library" level. If they distribute changes to the library (stand alone or together with a program that calls functions in the library), they must do so under the LGPL, but they are under no license obligation to go open source for programs that only call the library.

They don't have to publish the program that calls the (modified or unmodified) library under the LGPL, but may do so under a propriety or permissive license as well.

The MPL works on a file level. If an entirely new code file is added, they are not bound by the MPL, but if they edit a file that was originally under the MPL, they do have to publish under the MPL.

Note that they are allowed to make changes to the library and not contribute anything back if they are not giving or selling the software to anyone. If they are only using it themselves, but nobody else receives a copy of the (compiled or uncompiled) software, they are under no obligation to publish whatever they changed.

For your situation the LGPL seems the best fit. You can choose between version 2.1 and version 3. Version 3 has protection against software patents and "tivoisation", which version 2.1 does not. This doesn't have any impact on the criteria you gave. Older versions are no longer relevant.

  • So, does the LGPL force people to contribute that code back to the community? The changed library or any files they added in order to change the library? Or does such a license not exist?
    – OmniOwl
    Dec 2, 2015 at 13:31
  • under the LGPL, if they sell or give away their changes to the code, they must do so under the LGPL, so it can be incorporated back in to the original version. If they only want to run the modified version on their computer(s), and never give it away or sell it, they don't have to.
    – Martijn
    Dec 2, 2015 at 13:33
  • Okay. It sounds like it's the license I'm looking for. See, I didn't want to go all out and force users to go open source or free software. I'd just like the library to not get swallowed up and modified so the public never gets to use those changes. Like Optimizations, Added Calls (like support to use it with JavaScript or otherwise) and others. That would be a big waste.
    – OmniOwl
    Dec 2, 2015 at 13:35

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.