Bruno Haible <[EMAIL PROTECTED]> writes: > I wish to export the symbols of external{i}.c without modifications, > whereas the symbols of internal{j}.c should get a prefix.
Doesn't the question of whether a symbol should get a prefix more properly belong to .h files than to .c files? That is, if it's declared in external{i}.h it should get exported, otherwise not. > Approach 1: Preprocess the include files internal{j}.h so that each > occurrence of > > extern ret_type_t func (...); > > is changed into > > #define func MY_PREFIX_func > extern ret_type_t func (...); > > Approach 2: Compile each of the internal{j}.c file to .o files, then > use "nm".... "nm" on the developer's platform, or on the installer's platform? ("nm" is a bit of a porting nightmare.) For approach 1, can't you also put the #define into config.h as well? That way you don't need to modify the C source for approach 1 (just as in approach 2). Did you consider doing it the way glibc does it, with the attribute_hidden macro? Perhaps gnulib could use the same syntax as glibc, albeit with different semantics on other platforms. If that doesn't suffice, there's also the syntax suggested by Niall Douglas <http://gcc.gnu.org/wiki/Visibility>, but I'd prefer keeping things compatible with glibc if possible.