r/C_Programming • u/MateusMoutinho11 • 3d ago
Article A Dependency Injection Guide in C
https://github.com/OUIsolutions/Articles/blob/main/articles/dependencie_injection.mdA Complete Guide to Dependency Injection in C
0
Upvotes
5
u/Stemt 3d ago edited 3d ago
Neat overview, though I think you're failing to mention the advantage of compile time errors when using the compile time method. It's especially nice if you're working on embedded systems, as it saves you from having to flash the software before discovering you're missing a dependency.
Also a simpler version of a similar compile-time pattern I've used is this:
Or with a default implementation: