melwin_jose
melwin_jose

Reputation: 325

CMOCKA / Linker : 'wrap'ping lots of functions

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 ?

Upvotes: 2

Views: 1396

Answers (1)

melwin_jose
melwin_jose

Reputation: 325

Invoke the compiler like this:

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

Upvotes: 5

Related Questions