"Clean room" reimplementation is legally safe (in most countries, anyway). For instance, if you take a free program designed to use the library (but which doesn't copy anything from the library), rediscover the library's API by looking at the calls made by the free program, and reimplement the library from that, you're definitely safe. You're safe looking at the published documentation of the library as well, as long as you don't copy literally from it.I wonder if there are any legal issues if I took the description of the api and implemented my only library, which would be for my purposes a sufficient replacement.
Interfaces themselves can't be copyrighted; only texts can be copyrighted. Referencing published works for information is legal as long as you don't copy any text (or only copy uncopyrightable segments of text). (Because the information is published, it can't be trade secrets.) Patents are another matter entirely, but it's best not to think too hard about them. :-/
You can use *uncopyrightable* portions of the header files. It might be legally safer not to mess around with the header files, if you can easily reconstruct appropriate "work-alike" headers from safer sources. (After all, your library needs its own headers, and you can't just copy the header file text wholesale.)Couldn't I publish my code without running into problems? May a use the header files from the commercial library or at least to the user of my library where to get them?
Disclaimer: I am not a lawyer; this is just my rough understanding of things.