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

Mohit Kumar mohit.kumar@gmail.com
Wed Jun 1 09:09:00 GMT 2005


Hey Corey,

Exaclty, I want to be able to specify it to link libone.a directly
when it is linking libtwo.a. This is just for clarity of code and the
flow.

Thanks,
Mohit

On 6/1/05, corey taylor <corey.taylor@gmail.com> wrote:
> Mohit,
> 
>   What is the result that you are looking for?  Do you not want to
> specify libone.a if you link libtwo.a or something else?
> 
> corey
> 
> On 5/30/05, Mohit Kumar <mohit.kumar@gmail.com> wrote:
> > 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