OK, so why _does_ ld resolve text against data?

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Aug 23 07:06:08 AEST 1990


In article <141151 at sun.Eng.Sun.COM> linden at eng.sun.com (Peter van der Linden) writes:
>it's even more heinous than the example he gives.  If you happen to 
>choose a function name that duplicates a library name, then your function 
>is used in preference to the library function both in your code AND in 
>any library routines you call!

This is the primary reason why the C standard severely constrains the
external-linkage identifiers that an implementation of the standard
library is permitted to use.

>Most of us know to avoid names like malloc, but everyone calls something
>index sooner or later.

This particular name is not a problem in a standard-conforming environment.

In general, when you link with nonstandard libraries, name-space collision
is a real possibility.  Ways for library designers to reduce this risk
have been discussed in the C newsgroup before.



More information about the Comp.unix.wizards mailing list