Statically linking a shared library to another library to be statically linked

Mohit Kumar mohit.kumar@gmail.com
Mon May 30 15:24:00 GMT 2005


Hi All,

First of all, apologies for such a cryptic subject, even I took some
time to figure out how should I frame the subject but could not think
of any better way.

I am stuck with the following scenario:

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?

I am aware I can do the following:
ar x libone.a ----> generates all the .o's
ar q libtwo.o *.o's 

However I am looking for a cleaner way.

Any help in this regard would be highly appreciable.

Thanks,
Mohit



More information about the Gcc-help mailing list