libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libraries and namespaces


From: Paul Eggert
Subject: Re: libraries and namespaces
Date: Wed, 11 Oct 2006 11:41:48 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Bruno Haible <address@hidden> 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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]