I have two questions, I would like to ask:
1) at the moment im refactoring my code and i have 6 functions, which share one function in common, exp.:
< pre> CodeSelect all;
static void bar(INT32 x) { }
void foo1() { bar(1); }
void foo2() { bar(2); }
now my question, is there a trick, i could put foo1 and foo2 in seperate .c files and keep bar still "static" thus invisible to outside linking?
is there a trick, i could put foo1 and foo2 in seperate .c files and keep bar still "static" thus invisible to outside linking?
Yes, there is. Put the definition of bar() into a header file and include it in both .c files (that contain foo1() and foo2()). The code for bar() will likely be generated twice, but that's a different matter.