Write an adapter or facade that wraps the external DLL. Make it implement the IExternalDLL interface (of course, choose the best name), which documents / defines your needs from an external DLL; he does not need to accurately simulate function signatures of the actual implementation.
Write down a set of "contract tests" on the interface as you expect the interface to work.
Now you can write different adapters for each new version - in case of some changes with a change from v1 to v2. Your client is abstracted due to the interface. Its adapter / façade task is to ensure that the appropriate dll version matches the contract test. You write one test suite and run it with all adapter / facade implementations. Next time a new version comes out, you can
- Use the latest adapter / façade if it suits your needs.
- deploy a new one to fix any violations; make sure that you run it in accordance with the contract tests so that your client does not break with this adapter.
Gishu source share