home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / sgi / 11604 < prev    next >
Encoding:
Text File  |  1992-07-29  |  1.9 KB  |  67 lines

  1. Newsgroups: comp.sys.sgi
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!sdd.hp.com!mips!odin!sgi!quasar.wpd.sgi.com!davea
  3. From: davea@quasar.wpd.sgi.com (David B.Anderson)
  4. Subject: Re: What's wrong with ldopen()???
  5. Message-ID: <ntnisfs@sgi.sgi.com>
  6. Sender: davea@quasar.wpd.sgi.com
  7. Organization: Silicon Graphics, Inc.  Mountain View, CA
  8. Date: Wed, 29 Jul 1992 19:49:11 GMT
  9. Lines: 56
  10.  
  11. In article <45863@shamash.cdc.com> pbd@runyon.cim.cdc.com (Paul Dokas) writes:
  12. >We just upgraded to 4.0.5 and it broke our dynamic loader :-(
  13. >
  14. >I've traced the problem down to ldopen().  Well actually with the
  15. >structure that ldopen() returns.  The code fragment that is
  16. >suspicious is:
  17. >
  18. >   #include <ldfcn.h>
  19. >
  20. >   void load(char *fname)
  21. >   {
  22. >     LDFILE *ld;
  23. >     int     fd;
  24. >
  25. >     ld = ldopen(fname, (LDFILE *) 0);
  26. >     fd = fileno(IOPTR(ld));
  27. >
  28. >     printf("fd = %d\n", fd)
  29. >
  30. >     ldclose(ld);
  31. >   }
  32. >
  33. >It always prints:
  34. >
  35. >     fd = -1
  36. >
  37. >:-(
  38. >
  39. >This worked on 4.0.1, but not under 4.0.5.
  40. >
  41. >BTW, I've omitted all of the calls to other ld* functions (ldread, etc)
  42. >that work.  It seems that the LDFILE structure is just not getting
  43. >filled in correctly.
  44.  
  45. There is no fd there.  LDFILE* should be considered an opaque pointer.
  46. This is because of the changes which allow ldfile to support ELF and XCOFF
  47. files interchangably.  Not that you can use or create ELF object files
  48. yet...
  49.  
  50. The changes *also* mean something like
  51.     LDFILE saveld;
  52.     ...
  53.     saveld = *ld;
  54.     .....do libmld calls.....
  55.     *ld = saveldfile; /* restore state? */
  56. is not going to work as LDFILE is NOT a complete picture of the data
  57. structure.
  58.  
  59. You can use those macros which are still supported. See
  60. /usr/include/ldfcn.h
  61.  
  62. Sorry we broke your code. The fd won't come back though (IMO).
  63. Various implementation details of libmld do change as we move
  64. toward ELF & SVR4.....
  65. [ David B. Anderson             (415)390-1548             davea@sgi.com ]
  66.  
  67.