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