Alright so lets say I've got a little library for graphics called... "GraphicsLib", a Physics library called "PhysicsLib", and another to hold them together... the "EngineLib." How can I go about making sure that EngineLib is not entirely dependant on GraphicsLib and PhysicsLib? I've read about Inversion of control/dependency injection and it sounds like it's the right thing for this, but it's left me a little bit puzzled.
What I've read about dependency injection is that you would create an interface and then inject the actual object you want it to be into the object using it. So in this example lets there would be an interface for the graphics and physics and then the Engine class would have a setter for each of those interfaces.
Now that's pretty straight forward but what happens when the graphics system isn't part of the same library? the interface needs to exist in both sections, the engine needs to know of the interfaces existence so it can call all of its functions yes? but then the graphics and physics libs need to know of their respective interfaces as well so they can inherit from them. Is Dependency injection really not the tool for the job here or am I just thinking about things all wrong?
I've also thought of an alternative where there is another library that both the "Engine" and the "Physics/Rendering" libs use that contains interfaces for everything the engine might use but... that seems like it could be a bit of a stretch to force this to work.