Is it possible to overload symbols in static libraries?

Mike Frysinger vapier@gentoo.org
Mon Aug 8 07:55:00 GMT 2011


On Wednesday, August 03, 2011 04:20:16 Rohit Arul Raj wrote:
> I have created a static library in libgloss.a, which by default dumps
> the input/output to console I/O.
> I also have an UART library. Now to dump the output to UART, i thought
> of overloading the console I/O functions (having them as weak
> symbols). But it seems that it doesn't work with archives.

it's a bit more subtle than that

> The solution that i can think of for now is:
> 1. Have separate libraries for console I/O and UART.
> 2. Link them with libgloss.a
> 
> Is there any better alternative?

you could use --whole-archive when linking and ignore the subtle issues
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/newlib/attachments/20110808/c692b0e6/attachment.sig>


More information about the Newlib mailing list