I understand that in certain jurisdictions such as the US, the legal concept of "work for hire" may be applicable, and that in those cases, there must be a written agreement in advance between the parties specifying that the work is a work made for hire, and the customer, not the developer, will then own the copyright and other intellectual property rights when the development is complete.
What is not clear to me is the common position where a developer has a set of existing code libraries, snippets, or modules which form part of the developer’s own library or toolkit, and which have either been created by the developer generically, or the developer has the express written permission of an existing customer that code elements from earlier custom work may be freely used without restriction in any future work by the developer, or the code contains third party elements which may be distributed under some form of licence, open source or otherwise – all of which are the case for us.
If a new customer asks for custom software to be developed, and they either explicitly have a work for hire agreement, or in countries where there is no direct equivalent, they instead ask for full ownership and legal rights in the developed software to be assigned to them upon completion, what is the legal position of the pre-existing code libraries which the developer built and pre-dated the new customer's work?
Obviously, we don't want to assign ownership of our code libraries and other property to a customer; we only want to assign them ownership of all the new code we develop for them, if they specifically ask for it.
Has anyone successfully dealt with this issue?