CMOCKA / Linker : 'wrap'ping lots of functions

我怕爱的太早我们不能终老 提交于 2020-01-03 03:06:23

问题


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 ?


回答1:


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



来源:https://stackoverflow.com/questions/32709235/cmocka-linker-wrapping-lots-of-functions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!