In an object-oriented language with inheritence and virtual functions, removing dependancies (e.g. database, API calls, etc) from your unit testing code can be as simple as encapsulating those dependancies in their own methods and then overriding those methods in a test class inheriting from the class to be tested.
However, I've run into a problem when trying to do something similar for procedural code (C specifically). Without inheritence I can't override those calls, so how does one provide similar removals of dependancies when unit testing procedural code?
One option would be to provide alternatives to the calls to these dependancies and surround them with #ifdefs, but the ideal approach would be to have the unit test apply to the same code as is going into the final build. Is this possible?