Software library legal question

Say I have a commercial C++ library that defines several different classes. The header files and the library/dll make up the product.

Now say I decide to take the header files, and rewrite the “guts” of the library. Basically, I’d recreate the library, keeping the exact same class names and public interface methods/attributes, but writing all of the underlying implementation code myself.

Would it then be illegal or a copyright issue to sell that recreated library as a replacement for the original?

Does it make a difference if I include extra functionality, say extra methods for some of the classes, that makes it slightly different?

Basically, a clone of the original library, meant to work in place of the original without any code changes to the user’s software (that uses the library).

IANAL, but I believe it would depend on the library. In many cases, the API itself is copyrighted, which would seem to preclude publishing an original library with the same interface.

Reverse engineering has just about always been upheld in court in the USA, so you could reverse engineer the libraries and write your own with no problem. BUT, you’d have to debate the definition of “reverse engineering.” If you reverse engineer, you’ll end up with the exact same headers, at least as far as the function names and methods and so on are concerned.

This is a good question, and am curious, too.

Thanks for the responses so far.

The reason is that we have software that was developed by us as a subcontractor of a larger system. We were given a library to use to interface with the rest of the system (startup/control/PMFL/etc).

Now we want to reuse that software on a system we’re developing ourselves, and to do so, we are recreating that library.

That got me thinking about the legality of copying library interfaces.

If it is indeed dependent on whether the API is copyrighted, what constitutes a “different” API? Is changing class names/method names enough, even if there’s a 1 to 1 correlation? That would only require a search and replace of the original software (easy enough, thanks JGSoft) to use the new names instead.

If anyone has examples of cases that already occurred, that’d be great also.