Subject: Re: weird link required, please help?
To: Kevin P. Neal <kpneal@pobox.com>
From: Andrew Brown <codewarrior@daemon.org>
List: current-users
Date: 05/03/1997 09:52:31
> From: Kevin P. Neal
>>At 10:55 PM 5/1/97 -0400, der Mouse wrote:
>>...
>>
>>Then foo1b.o has only the listed symbols visible; everything else was
>>made local by localsym, then stripped by ld -x -r.
>
>Hey, nifty. How would something like this interact with debuggers? 
>
>I've been told that some debuggers blow chunks when they come across static
>functions in a program (where multiple static functions with the same name
>exist in a program). Would this do the same thing, except on a library
>scale (instead of source file scale)? 

it would probably be fine.  even though the names are the same, the function
call is actually in the program with the address of the function.  the
debugger would just follow that.

>>Of course, this may not solve your problem; it may not be possible for
>>both versions of the library to coexist in the same process because
>>they clash over some shared resource, such as the current directory, or
>>the open file table.  I assume you've considered such dangers.
>
>How does namespace normally stay sane? I mean, X has it's Xfunctions, 
>Xtfunctions, Xmfunctions, etc. What do other libraries do to avoid 
>clashing over names? 

normally, any global (or external) functions are all fine together so long
as each name only appears once.  libraries that have to co-exist need to
cooperate on this.  what i'm trying to do is weird and the libraries
need to be slapped about to get it to work.

>How would a library export an interface, and then keep it's internals hidden
>from the rest of the program? (Don't even think of saying "C++")

it would declare the "internal" functions static in the given source
files.  this would render them invisible to the rest of the program,
since only other functions in that particular object file would be able
to call them.

so what i need to do is link against a global interface to a library,
and then static-ize the actual library functions so that when i link
the two libraries together (along with a third set of like symbols) i
don't get errors from the linker about such and such symbol being
defined twice.

-- 
|-----< "CODE WARRIOR" >-----|
andrew@echonyc.com (TheMan)        * "ah!  i see you have the internet
codewarrior@daemon.org                               that goes *ping*!"
warfare@graffiti.com      * "information is power -- share the wealth."