Decoupling c++ modules (plugins) but both depend on an interface

I am currently optimizing a few plugins and reducing their dependencies. I have the following situation:

A UI Plugin: Interacts with anything deriving from Interface X.
A Subsystem plugin: Which happens to implement Interface X.

The only thing that binds these two modules together is a shared interface, so I’d rather not merge them into a single module. What is the best way to decouple these modules entirely?

My goal is to make these plugins fully “standalone” from eachother and let a user connect systems from various plugins through matching interfaces.

Typically, you’d make the UI plugin depend on the Subsystem plugin.
That way, you can ship Subsystem only, or Subsystem+UI.
If you necessarily need to be able to ship UI only, then you need a third module, which defines the shared interface.
Then you can ship Subsystem+Interface, or UI+Interface, or Subsystem+UI+Interface.

1 Like

I thought of that, making a third “Core” module to put things in that are reused, but the bigger the project gets the more I want it to break apart into standalone modules, so that you don’t get a huge “core” module dependency for every small plugin. I think you are right, that there is no other way.