I have a set of C++ libraries and now I would like provide a common API interface for this dll’s!
The idea is to use a facade design pattern; but cant apply this on dll’s, only on objects/classes! I think it’s necessary to merge all the code in one single library (single project) with this design, isn’t it?
Any ideas?!
Thank you very much!
greets
Background:
You don’t need to pack everything in one DLL. One of the purposes of this pattern is to simplify dependencies. Its clients can have only a dependency to that DLL (but your interface could be spanned across multiple DLLs, if needed). For example:
Now you want to provide a simple beautiful interface for this task. An object to represent a message, another one for the connection and so on. You’ll create another DLL (Smtp.dll, for example) that depends on Base64.dll, Network.dll, RegEx.dll, MailHelpers.dll and it exposes one common high level C++ interface. Its clients will add a dependency to this DLL and they won’t know anything about others.
So, finally, the answer is no, you do not need to merge all code (of what you want to hide with a facade) in a single library.
Second scenario: your facade library is going to be more complex. You want to strip all advanced tasks from Smtp.dll to another library and you plan to create a helper library to make common tasks very easy. You’ll have something like this:
Second answer is no again, you’re using a facade pattern again and your facade is spanned across multiple DLLs.