Re: Fwd: Statically linking a shared library to another library to be statically linked

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mohit Kumar <mohit.kumar@xxxxxxxxx> writes:

> Suppose I have three files: libone.a, libtwo.a and libmain.so, and I
> want to implement the followinf hierarchy:
>     libmain.so
>         |-----libtwo.a
>                    |-----libone.a
> 
> As far as linking libtwo.a to libmain.so is concerned I am aware I
> need to use '-l' flag at link time.
> But is there a way I can link a .a file to another .a file?

This is not a gcc question.  It is a binutils question.  Or a Unix
programming question.

The answer is no.  An archive is simply a collection of object files.
There is no meaningful way to link one archive to another archive.

If you will be using only the GNU linker, you could play some tricky
games with linker scripts.  For example, look at /usr/lib/libc.so on a
typical GNU/Linux system.  But I wouldn't describe that as a clean
approach.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux