I recently came across the 'cmocka' mocking library for C. I was able to mock a single function and test the caller function successfully. Now i need it to use it for a project that i am working on, where it is required to mock a large number of functions. How to pass all the functions that I want to mock to the 'wrap' argument of Linker ? Is it possible to store the names of functions in a file, so that it could be picked up the linker ?
CMOCKA / Linker : 'wrap'ping lots of functions
Asked Answered
Invoke the compiler like this:
gcc -g -Wl,--wrap=something,--wrap=somethingElse code_new.c headers.c -l cmocka
© 2022 - 2024 — McMap. All rights reserved.