home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / aix / 12900 < prev    next >
Encoding:
Text File  |  1992-12-29  |  1.8 KB  |  53 lines

  1. Path: sparky!uunet!vnet.ibm.com
  2. From: russotto@vnet.ibm.com (Matthew T. Russotto)
  3. Message-ID: <19921229.061338.793@almaden.ibm.com>
  4. Date: Tue, 29 Dec 92 09:03:46 EST
  5. Newsgroups: comp.unix.aix
  6. Subject: Re: problem load()-ing shared object
  7. Disclaimer: This posting represents the poster's views, not those of IBM
  8. News-Software: UReply 3.1
  9. References: <609@bertha.HyperDesk.com>
  10.             <C0084n.y2@unixhub.SLAC.Stanford.EDU>
  11. Lines: 40
  12.  
  13. In <C0084n.y2@unixhub.SLAC.Stanford.EDU> J. Scott Berg writes:
  14. >Anyhow, I'm sure this isn't making much sense to you, because it
  15. >certainly doesn't make any sense to me.  Enclosed is my current
  16. >version of your test code which basically has more diagnostics and
  17. >gets past the load part.
  18. >
  19. >Good luck!  If you figure out how to do this, I'd love to know.  God
  20. >bless
  21. >
  22. >                       -Scott Berg
  23. >
  24. >When executed, my foo2 outputs:
  25. >
  26. >Err: 0
  27. >10000000 5761 20041800 104
  28. >foo2
  29. >d07ea000 1749 20047400 24
  30. >bar2.so
  31. >Test: hello, world
  32. >
  33. >20041810
  34. >Got here!
  35. >68656c6c           <---- Wouldn't have printed this without the loadbind()
  36. >Segmentation fault
  37.  
  38. Your problem has nothing to do with load/loadbind, which you are using
  39. properly.  Instead, there's an obscure type incompatibility.
  40. (excuse my EBCDIC in the following, you'll have to guess at the square
  41. brackets)
  42.  
  43. >char global_string[] = "hello, world\n";  /* here's the global */
  44. in foo2.c defines foo2 as a pointer constant pointing to "hello, world\n"
  45.  
  46. >extern char *global_string;
  47. in bar2.c refers to a pointer VARIABLE.  They aren't the same!
  48. Note that 0x68656c6c = 'hell' (the first 4 characters of "hello, world\n"
  49. ,not the machine cursing at you...).  Change that to
  50. extern char *global_string^:;
  51. (that's an open and close square bracket after global_string, followed
  52. by a semicolon), and things work fine.
  53.