CMOCKA /连接器:'wrap'ping很多功能 [英] CMOCKA / Linker : 'wrap'ping lots of functions

查看:504
本文介绍了CMOCKA /连接器:'wrap'ping很多功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到了 cmocka 嘲讽库来为C.我能嘲笑一个单一的功能和测试成功的调用函数。现在我需要它,使用它为我工作的一个项目,它需要嘲笑了大量的功能。如何通过所有我需要模拟到连接器的'包裹'参数的功能呢?是有可能的函数的名称存储在文件中,以便它可以被拾起接头

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 ?

推荐答案

gcc的-g轮候册, - =包裹的东西, - 包装= somethingElse code_new.c headers.c -l cmocka

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

这篇关于CMOCKA /连接器:'wrap'ping很多功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆