This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: linking question


Karsten Fuhrmann <karsten_fuhrmann@cartoon-film.de> writes:

> I want to compile a c program with both static and dynamic linking in
> the same program, e.g. i want to link against LIB_A  static but
> against LIB_B shared.
> I dicovered the static and dy options in ld but it seems to me that it
> is only possible to link at whole static or dynamic, but not mixed.

The -Bstatic and -Bdynamic linker options apply only to libraries
which follow them, so you can do:
    -Bstatic LIB_A -Bdynamic LIB_B

When linking from the gcc command line, you will need to use -Wl, as
in:
    -Wl,-Bstatic LIB_A -Wl,-Bdynamic LIB_B

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]