home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sgi
- Path: sparky!uunet!elroy.jpl.nasa.gov!sdd.hp.com!mips!odin!sgi!quasar.wpd.sgi.com!davea
- From: davea@quasar.wpd.sgi.com (David B.Anderson)
- Subject: Re: What's wrong with ldopen()???
- Message-ID: <ntnisfs@sgi.sgi.com>
- Sender: davea@quasar.wpd.sgi.com
- Organization: Silicon Graphics, Inc. Mountain View, CA
- Date: Wed, 29 Jul 1992 19:49:11 GMT
- Lines: 56
-
- In article <45863@shamash.cdc.com> pbd@runyon.cim.cdc.com (Paul Dokas) writes:
- >We just upgraded to 4.0.5 and it broke our dynamic loader :-(
- >
- >I've traced the problem down to ldopen(). Well actually with the
- >structure that ldopen() returns. The code fragment that is
- >suspicious is:
- >
- > #include <ldfcn.h>
- >
- > void load(char *fname)
- > {
- > LDFILE *ld;
- > int fd;
- >
- > ld = ldopen(fname, (LDFILE *) 0);
- > fd = fileno(IOPTR(ld));
- >
- > printf("fd = %d\n", fd)
- >
- > ldclose(ld);
- > }
- >
- >It always prints:
- >
- > fd = -1
- >
- >:-(
- >
- >This worked on 4.0.1, but not under 4.0.5.
- >
- >BTW, I've omitted all of the calls to other ld* functions (ldread, etc)
- >that work. It seems that the LDFILE structure is just not getting
- >filled in correctly.
-
- There is no fd there. LDFILE* should be considered an opaque pointer.
- This is because of the changes which allow ldfile to support ELF and XCOFF
- files interchangably. Not that you can use or create ELF object files
- yet...
-
- The changes *also* mean something like
- LDFILE saveld;
- ...
- saveld = *ld;
- .....do libmld calls.....
- *ld = saveldfile; /* restore state? */
- is not going to work as LDFILE is NOT a complete picture of the data
- structure.
-
- You can use those macros which are still supported. See
- /usr/include/ldfcn.h
-
- Sorry we broke your code. The fd won't come back though (IMO).
- Various implementation details of libmld do change as we move
- toward ELF & SVR4.....
- [ David B. Anderson (415)390-1548 davea@sgi.com ]
-
-