Is it possible to write alternative implementation of a library which is covered under LGPL 2.1 and keeping the same API ? The alternative implementation will be in the closed source.

  • How would you discover the API in order to reimplement it?
    – MadHatter
    Feb 28 '19 at 9:47
  • @MadHatter from headers ?
    – addy
    Feb 28 '19 at 10:37
  • You mean from reading the existing LGPL library code?
    – MadHatter
    Feb 28 '19 at 11:06
  • @MadHatter If I want just headers and struct. Not the implementation behind it.
    – addy
    Feb 28 '19 at 13:33

In general, a reimplementation of some software is not a derivative work of that software, thus the license of the original software is irrelevant. This holds in particular when the reimplementation used a clean-room design approach.

Unfortunately, APIs themselves may be creative works and therefore copyrightable. This would render any reimplementation of the API derivative as it has copied the API. Without a license this would be copyright infringement, though many jurisdictions have copyright exceptions that could apply here (like fair use in the US).

API copyrightability and fair use are major themes in the Oracle v Google lawsuits about the use of Java in Android. Of course, that lawsuit does not set any precedent outside of the US.

In the case of an LGPL-covered library, a safe workaround is possible that avoids a direct API copy, but lets users switch between the LGPL-covered library and your implementation:

  1. Design an alternative API that achieves the same purpose. Publish a description of the API under a permissive license or through some standards body.
  2. Optional: Implement an adapter from the LGPL-covered API to your new API.
  3. Create a proprietary implementation of the new API.

Such workarounds would not be possible if the library were using the GPL instead.


Your problem is that any reading of the existing code by the person who re-implements the library opens up the possibility that what you write is then a derivative work of what you read, and thus must also be released under LGPL (or GPL), as the answer to this question makes clear.

That's why we have the idea of the clean room reimplementation, which you can read more about in this answer. I can't say for certain that reading the header files would be enough to make your work a derivative of the existing library, but your having done so must surely raise that possibility.

Edit: @amon and I have disagreed about this before, but since (s)he's chosen to write an answer, and I believe that answer rests on a fundamental error, I'll directly address it here. (S)he writes:

In general, a reimplementation of some software is not a derivative work of that software, thus the license of the original software is irrelevant.

That is flatly contradicted by, eg, the FSF FAQ, which says that

Under copyright law, translation of a work is considered a kind of modification. Therefore, what the GPL says about modified versions applies also to translated versions. The translation is covered by the copyright on the original program.

There is no difference in copyright between a translation into another human language, and into another machine language; in Apple v. Franklin it was originally argued that there was a difference, but the 3rd Circuit Court of Appeal rejected the argument, see eg this summary. So, since the copyright of the original program still applies, then whether the licence on it permitted modifications (such as translation) is fully relevant. I continue to hold that the clean room reimplementation is the only strategy which reliably decouples reader-of-old-code from writer-of-new-code, and thus avoids the tricky problem of having to prove a negative in court.

  • I would say that a re-implementation and a translation are two different things. In a translation, you generally take the original code and translate that to a different language while keeping the essential nature of the code. In a re-implementation the original work is treated more as a black box and you try to re-create the same behavior. I do agree that a re-implementation can be a derived work of the original. Mar 10 '19 at 8:42
  • The 3rd Circuit Court of Appeal seems to disagree: there is no difference between translating a copyrighted novel into a different human language, and translating a copyrighted program into a different machine language, in terms of how copyright is handled. I'm not saying an argument can't be made that they're different; I'm saying the argument has already been made in open court, and (subsequently) rejected. When it comes to re-implementation, we must be careful to distinguish between those done by reading and translating the source, and those done without any access to the original source.
    – MadHatter
    Mar 10 '19 at 11:19
  • Re "what if you read the headers?" - The LGPL 2.1 and 3.0 both have header carve-outs which may be relevant here.
    – Kevin
    Mar 12 '19 at 19:46
  • Is this email conversation relevant? It seems to imply that reading the headers of even a GPL library isn't enough to bite you. I can't imagine it's legally binding, though.
    – HTNW
    Mar 22 '19 at 22:35

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.