Article View: comp.sys.sun
Article #10789Re: Shared libraries linker error
From: Juergen Wagner
Date: Wed, 08 Feb 1989 08:23
Date: Wed, 08 Feb 1989 08:23
58 lines
3063 bytes
3063 bytes
[I am sending the reply to the entire list because I think there's been
some confusion about the new select(2) syntax.]
In article <615@dutrun.UUCP> mcvax!duttnph!hans@uunet.uu.net (Hans Buurman) writes:
>...
>One user on a Sun 3/60 that has recently been upgraded to SunOS 4.0 was
>complaining about a function dumping core that should not have been used
>at all. It turned out that he had a function called select() in his
>program.
Hmm... There is also a system call select(2) in SunOS4.0. This isn't
particularly notable but the syntax has changed from 3.x to 4.x. Unless
done deliberately, one shouldn't use names of system call for one's own
functions.
>One of the SunView routines he called (to initialize a panel) also used a
>function called select(), which is in ndet_select.o in libsunwindow.a. It
>looks like the compiler had linked the sunwindow calls to select() to his
>own program.
/*
* Ndet_select.c - Notifier's version of select....
And if you look at the declaration:
extern int
select(nfds, readfds, writefds, exceptfds, timeout)
register int nfds;
fd_set *readfds, *writefds, *exceptfds;
struct timeval *timeout;
What the linker did was correct. It used the libsunwindow.a version of
select because this library was mentioned first on the cc line: something
like
cc -o foo foo.c -lsunwindow -lpixrect
Even if you used the standard version of select, the core dump should
still be there. Consult your man page for select(2) for the changed
syntax.
--
Juergen Wagner gandalf@csli.stanford.edu
wagner@arisia.xerox.com
[[ On this topic, I have noticed that the old select kernel call was
retained for backward compatibility. A program that uses "select" and
that is compiled and linked on a 3.x machine will, under most
circumstances, still work correctly under 4.x (because it's using the old
select kernel call). But before you can compile it on a 4.x machine, you
*must* make some changes. Read the new manual page for select(2) to see
how it must be changed. This backward compatibility move was likely
documented, but I'm too busy (or is that "lazy") to go look it up right
now. To be more specific: the new select can handle file descriptor
masks longer than 4 bytes (thus it can handle file descriptors >= 32).
The old one assumed that the mask was 4 bytes. You can use old
executables provided that you never try to "select" on a fd >= 32.
--wnl ]]
Technical Details
Message-ID:
<8901290118.AA21121@csli.Stanford.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-requestReferences:
<615@dutrun.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request From: gandalf@csli.stanford.edu (Juergen Wagner) Newsgroups: comp.sys.sun Subject: Re: Shared libraries linker error Message-ID: <8901290118.AA21121@csli.Stanford.EDU> Date: 8 Feb 89 08:23:29 GMT References: <615@dutrun.UUCP> Sender: usenet@rice.edu Organization: Center for the Study of Language and Information, Stanford U. Lines: 58 Approved: Sun-Spots@rice.edu Original-Date: Sat, 28 Jan 89 17:18:59 PST X-Sun-Spots-Digest: Volume 7, Issue 142, message 3 of 8