This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: stupid ld tricks
- To: "Michael Sterrett -Mr. Bones.-" <msterret at coat dot com>
- Subject: Re: stupid ld tricks
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Wed, 21 Jun 2000 16:00:13 -0700
- Cc: binutils at sourceware dot cygnus dot com
- References: <Pine.LNX.4.21.0006211843180.6456-100000@swamp.coat.com>
On Wed, Jun 21, 2000 at 06:55:47PM -0400, Michael Sterrett -Mr. Bones.- wrote:
> I'm trying to use the -Bstatic -Bdynamic flags to ld to link certain
> libraries statically to my application and others dynamically.
>
> I had hoped something like this would work:
>
> cc -o app.o -c app.c
> ld -o app app.o -Bstatic -la -Bdynamic -lb -lc
>
Never call ld directly unless you know what you are doing. Use
gcc and -Wl,-Bstatic -la -Wl,-Bdynamic:
# gcc -o app app.o -Wl,-Bstatic -la -Wl,-Bdynamic -lb
H.J.