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 ?

melwin_jose
  • 315
  • 3
  • 20

1 Answers1

5

Invoke the compiler like this:

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

Per Lundberg
  • 3,837
  • 1
  • 36
  • 46
melwin_jose
  • 315
  • 3
  • 20