Let's say I have a file f1.c with the following:
Code:
int two(int a, int b) {
return a + b;
}
And a file f1.h with the following:And a file f2.c with the following:
Code:
#include "f1.h"
int one(int a, int b, int c) {
return two(a, b) * c;
}
I only want to expose the one function, so the two function should be unlinkable from other files when f1.c and f2.c are compiled into e.g. f12.o (to avoid unexpected errors from happening when somebody who links my code to theirs also has a function named "two").
However, if I make the definition in f1.c static, then I won't be able to use the two function in f2.c. Is there a portable way to achieve this effect without merging everything into one source file?