Please help with __attribute__ weak
H. J. Lu
hjl@lucon.org
Tue Jul 26 14:01:00 GMT 2005
On Tue, Jul 26, 2005 at 07:19:43AM -0400, Dimitry Golubovsky wrote:
>
> I need to declare a symbol which is weaker in the executable than in any
> external static or dynamic library.
>
> In other words, the executable provides some fallback function
> implementation (in my example, for "write"). But if the linker or
> dynamic linker resolves it, the symbol definition from an external
> library must be used.
>
The weak symbol is different from the normal one only during creating
executable or shared library if it is in a relocatable file. You
can't use weak symbol for your purpose. But you can mark your symbol in
shared library protected.
H.J.
More information about the Gcc
mailing list