Open thekenu opened 4 years ago
the embedded C code must be imported into gtest files using extern C
You mean you have to add extern "C"
guards around C header files?
extern "C"
{
#include <some_c_header.h>
}
Is it ALSO necessary to guard things like DECLARE_FAKE_VOID_FUNC with extern C in this case
I don't know which linker you're using, but with the GNU linker, unless I wrap the fakes like so:
extern "C"
{
FAKE_VALUE_FUNC(uint8_t , some_function, uint8_t);
}
I get a linker error because of name mangling.
I am using
fff
to mock inputs to these embedded C functions and usinggtest
(C++ framework) to run test suites. Naturally, the embedded C code must be imported intogtest
files usingextern C
. Is it ALSO necessary to guard things likeDECLARE_FAKE_VOID_FUNC
withextern C
in this case? The project seems to compile either way so I'm curious if there's a best practice.