[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: When linking, why -L's *must* come before -l's??? Why -l's can come
From: |
Thien-Thi Nguyen |
Subject: |
Re: When linking, why -L's *must* come before -l's??? Why -l's can come before function calls?!! |
Date: |
02 May 2003 17:51:12 -0400 |
<address@hidden> writes:
Why is gcc compiler smart enough to let you put -l's BEFORE object
files and main() but not smart enough to let you put -L's *after*
-l's on command line when linking??
the -L is analogous to setting PATH in the shell; the following usages
(-l for linker, commands for shell) are effected by it until the next
change. suppose you had a /bin/ls and a $HOME/bin/ls (the latter being
part of your rootkit scanner, e.g.). you could write a script to make
use of both, like:
PATH=/usr/bin:/bin
ls # resolves to /bin/ls
PATH=$HOME/bin:$PATH
ls # resolves to $HOME/bin/ls
same kind of thinking goes for the -L and -l ordering and "shadow
library sets". at least, this is the story i tell myself...
thi