|
|
|
|
|
by shadowmint
5096 days ago
|
|
You're almost always better off using an ABI and shared libraries than doing this. That said, there are cases where it's useful; but remember: dependency injection is an anti-pattern that increases code complexity to facilitate run-time configuration and testing. Without a helper IOC framework (that does the hard work of maintaining singleton instances and injecting the right ones in the right places at the right time) doing this is a lot of work in a large project. ...not saying it's a bad thing. It's totally a good thing, especially making your C code testable. Just be aware that there are limitations and downsides to this beyond merely the potential speed cost in using pointers and optimization issues mentioned above. |
|