CMOCKA / Linker : 'wrap'ping lots of functions
Asked Answered
B

1

2

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 ?

Bo answered 22/9, 2015 at 5:45 Comment(0)
B
5

Invoke the compiler like this:

gcc -g -Wl,--wrap=something,--wrap=somethingElse code_new.c headers.c -l cmocka

Bo answered 23/9, 2015 at 4:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.