You need a third assembly to act as an interface between the two. This interface assembly would export all the required objects and/or methods required for the two other assemblies to communicate with one another.
This following example is of course considering .NET as the platform, but the same exact concept can be used in Win32/C++ projects.
This is sort of a tough one in regards to architecture. Two DLL's in .NET cannot directly communicate two ways without some overhead, however, you can communicate one way. The reason is you can only reference one assembly from another, otherwise you will have a circular reference.
There is a simple solution though, but this would require three assemblies on your part. Take the following assemblies:
- Interface.dll
- Client.dll
- Server.dll
Just by names you should be able to get a good idea of how this is going to work. Basically, Interface.dll would contain the exposed objects that both Client.dll and Server.dll would need to communicate with one another. Both Client.dll and Server.dll would reference and Interface.dll to gain access to these objects.
With that method, both assemblies have access to all the objects that either one would need to communicate. Interface.dll would also contain exposed methods that both Client.dll and Server.dll would need to communicate. So it could contain for example a "Send" and "Receive" methods, that either Client.dll or Server.dll can use.
You would have to develop some sort of communication standard for this.
- What are these assemblies going to communicate with one another?
- How are these assemblies going to communicate?
With those two being said, whether you are communicating actual classes and objects or just messages, a third assembly to handle this would work flawlessly, as long as you put in the effort in the architecture and design.
Don't take the names to heart, Client.dll, Server.dll, and Interface.dll are all just examples of a common methodology of how such a task can be done. Using this method, there would be no circular references, and thus your assemblies could communicate two ways, instead of one.