Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LGPL-like license for a header-only C++ library [closed]

My understanding is that a program can link dynamically to an LGPL library and include its headers, possibly with modifications, without the program having to be released under the LGPL, but any modifications to the source code that goes into building the dynamic library must be released under the LGPL.

In effect, this allows people to use the library without restrictions, but they have to contribute back any changes they make to it.

I would like to release a C++ library that I wrote as FOSS, and I would like to license it in the same spirit: allow people to use it without having to release the code that uses it, but having to release any changes they make to it. However, the LGPL itself is not a good fit for me because my library is entirely header-only (it's a template library).

What license would serve this purpose?

like image 223
HighCommander4 Avatar asked Jul 09 '12 22:07

HighCommander4


People also ask

Is LGPL free for commercial use?

You can use and distribute LGPL libraries on your website and use them in combination with commercial code. The only big restriction is that you must keep the library open source, including any modifications you make to it, and allow your users to obtain the source, licence and copyright information for the library.

Are header-only libraries good?

For example, header-only libraries sometimes increase code size & compilation times. "Having a header-only library also means you don't have to worry about different platforms where the library might be used": only if you don't have to maintain the library.

How do header-only libraries work?

In the context of the C or C++ programming languages, a library is called header-only if the full definitions of all macros, functions and classes comprising the library are visible to the compiler in a header file form.

Can I stop others from using my program under the terms of GPL?

No. The GPL says that your modified versions must carry all the freedoms stated in the GPL. Thus, anyone who receives a copy of your version from you has the right to redistribute copies (modified or not) of that version.


1 Answers

Eigen is a header only C++ library released under the LGPL3 licence. There are useful information about it on their Licensing FAQ page.

Another option is the CDDL licence. It is similar to LGPL, but it is a file based licence: you can use licensed files in any way you want as long as you make no changes to them. If you do, you'll have to share (only) those changes. One of the advantages over LGPL is that you can statically link CDDL libraries without sharing anything (of course this is irrelevant in this case, since your library is header only). One of the disadvantages is that it is incompatible with GPL licence (see here under MPL licence).

See also some FAQs on CDDL.

like image 190
Claudio Avatar answered Oct 15 '22 09:10

Claudio