On 05/08/2016 13:59, Neil Horman wrote: > On Fri, Aug 05, 2016 at 10:11:56AM +0100, Remy Horton wrote: [..] >> Cmocka's mocking relies on Gnu ld's --wrap feature, which has problems if >> the function being mocked is defined in the same compilation unit that it is >> used. Pity really as otherwise it looked quite good to me. >> > Can't you use ld's --undefined option to get the correct behavior? I thought > that was specifically what it was there for.
Not sure - I'll try playing around with it when I next have some spare time.. :) The C-Mock extension (https://github.com/hjagodzinski/C-Mock) for GMock uses some dynamic linker trickery which I'm guessing is probably not C++ specific, and I quite like that approach as it avoids the need to pre-specify in makefiles which functions are to be mocked. ..Remy