Re: Same symbol, two libraries
- From: Paul Pluzhnikov <ppluzhnikov-nsp@xxxxxxxxxxx>
- Date: Wed, 26 Apr 2006 23:32:51 -0700
Frank Cusack <fcusack@xxxxxxxxxxx> writes:
I thought the search order was "this" library first?
Only with -Bsymbolic, which is not the default.
$ cat foo.c
int bar() { printf("bar from %s\n", __FILE__); return 42; }
int foo() { printf("foo from %s\n", __FILE__); return bar(); }
$ cat foo2.c
int bar() { printf("bar from %s\n", __FILE__); return 24; }
int foo2() { printf("foo2 from %s\n", __FILE__); return bar(); }
$ cat main.c
int main() { return foo() + foo2(); }
$ cc -G -o foo.so foo.c && cc -G -o foo2.so foo2.c &&
cc main.c ./foo.so ./foo2.so && ./a.out; echo $?
foo from foo.c
bar from foo.c
foo2 from foo2.c
bar from foo.c
84
$ cc -Bsymbolic -G -o foo2.so foo2.c && ./a.out; echo $?
foo from foo.c
bar from foo.c
foo2 from foo2.c
bar from foo2.c
66
The '-Bsymbolic' is effectively the default on AIX and Win32,
and is one of the things that makes porting between Win32 or AIX
and the rest of UNIXes such a pain.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
.
- References:
- Same symbol, two libraries
- From: u . int . 32 . t
- Re: Same symbol, two libraries
- From: Frank Cusack
- Re: Same symbol, two libraries
- From: u . int . 32 . t
- Re: Same symbol, two libraries
- From: Paul Pluzhnikov
- Re: Same symbol, two libraries
- From: Frank Cusack
- Same symbol, two libraries
- Prev by Date: mpathd question
- Next by Date: Re: Track process
- Previous by thread: Re: Same symbol, two libraries
- Next by thread: Cache
- Index(es):
Relevant Pages
|