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.
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:
- Design an alternative API that achieves the same purpose. Publish a description of the API under a permissive license or through some standards body.
- Optional: Implement an adapter from the LGPL-covered API to your new API.
- 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.