title: Mock/Wrap static functions called by a non-static function under test
body: <p>I would like to test some functions by implementing unit tests with cmocka framework.</p>
  
  <p>For example I have a non-static function under test which calls two static functions. Because of the fact that these static functions interact with hardware I want to mock/wrap them and use a wrap function instead of the real function when testing.</p>
  
  <p>Like described in the cmocka documentation I've used the --wrap=myfunction linker flags when building/linking my tests.</p>
  
  <p>The tests compile but when I run them the real static functions will be called instead of the wraps.</p>
  
  <p>When I declare the static functions non-static it doesn't work either and also the real functions are called. The only solution I've found is to outsource the functions in an extra .c-file...but that's a really bad workaround because it manipulates the code very much.</p>