fileA.c has a static function (static int funcA())
The fileA.c can not be modified.
fileB.c How can I use the funcA()?
fileA.c has a static function (static int funcA())
The fileA.c can not be modified.
fileB.c How can I use the funcA()?
In general you cannot, that's the entire point of static in this case.
Perhaps fileA.c has a way to get the address of the function, then you can use that to make a call, but you can't reference static symbols directly.
For test code, one "trick" that's often done is to #include the C file in the test file, so in fileA_test.c you'd have:
#include "fileA.c"
bool test_fileA_something(void)
{
TEST_ASSERT(foo() == 42);
}
The above assumes that foo is a static function inside fileA.c, and this works since the files are compiled together.
Not. The compiler has every right to not include funcA in fileA.obj. And even if it is included, it might not be in a form that the linker can use. In fact, if included it must be in a way that doesn't clash with other functions names funcA