I\'m maintaining a legacy project written in C and it\'s unfeasible to get it running with a C++ compiler. Since the code is cross compiled it is however possible to run uni
Your question specifically mentions Google Mock, but then does not state any other reason for using that framework. The other answer suggests using a workaround which seems unnecessarily intrusive.
Hence I hope I am allowed to make an alternative suggestion which works well without having to use weak aliases etc.
I have used CppUTest (https://cpputest.github.io/) for unit test with mock, successfully on a couple of large mainly-C projects (some C++). The mocking works without having to resort to any subterfuge of the above sort.
Unfortunately the project documentation is a little weak, some better (if a little agile-doctrinaire) information and examples in the book (also seen circulating as a PDF) "Test Driven Development for Embedded C" - James W Greening (ISBN-13: 978-1-934356-62-3)