public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Statically linking a shared library to another library to be statically linked
@ 2005-05-30 15:24 Mohit Kumar
  2005-06-01  5:43 ` Fwd: " Mohit Kumar
  2005-06-01  5:46 ` corey taylor
  0 siblings, 2 replies; 6+ messages in thread
From: Mohit Kumar @ 2005-05-30 15:24 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Fwd: Statically linking a shared library to another library to be statically linked
  2005-05-30 15:24 Statically linking a shared library to another library to be statically linked Mohit Kumar
@ 2005-06-01  5:43 ` Mohit Kumar
  2005-06-01 14:33   ` Ian Lance Taylor
  2005-06-01  5:46 ` corey taylor
  1 sibling, 1 reply; 6+ messages in thread
From: Mohit Kumar @ 2005-06-01  5:43 UTC (permalink / raw)
  To: gcc-help

Resending due to no response ....

---------- Forwarded message ----------
From: Mohit Kumar <mohit.kumar@gmail.com>
Date: Mon, 30 May 2005 17:52:37 +0530
Subject: Statically linking a shared library to another library to be
statically linked
To: gcc-help@gcc.gnu.org

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Statically linking a shared library to another library to be statically linked
  2005-05-30 15:24 Statically linking a shared library to another library to be statically linked Mohit Kumar
  2005-06-01  5:43 ` Fwd: " Mohit Kumar
@ 2005-06-01  5:46 ` corey taylor
  2005-06-01  9:09   ` Mohit Kumar
  1 sibling, 1 reply; 6+ messages in thread
From: corey taylor @ 2005-06-01  5:46 UTC (permalink / raw)
  To: Mohit Kumar; +Cc: gcc-help

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
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Statically linking a shared library to another library to be statically linked
  2005-06-01  5:46 ` corey taylor
@ 2005-06-01  9:09   ` Mohit Kumar
  2005-06-01 15:33     ` Ishwar Rattan
  0 siblings, 1 reply; 6+ messages in thread
From: Mohit Kumar @ 2005-06-01  9:09 UTC (permalink / raw)
  To: corey taylor; +Cc: gcc-help

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
> >
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Fwd: Statically linking a shared library to another library to be statically linked
  2005-06-01  5:43 ` Fwd: " Mohit Kumar
@ 2005-06-01 14:33   ` Ian Lance Taylor
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Lance Taylor @ 2005-06-01 14:33 UTC (permalink / raw)
  To: Mohit Kumar; +Cc: gcc-help

Mohit Kumar <mohit.kumar@gmail.com> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Statically linking a shared library to another library to be statically linked
  2005-06-01  9:09   ` Mohit Kumar
@ 2005-06-01 15:33     ` Ishwar Rattan
  0 siblings, 0 replies; 6+ messages in thread
From: Ishwar Rattan @ 2005-06-01 15:33 UTC (permalink / raw)
  To: Mohit Kumar; +Cc: corey taylor, gcc-help



On Wed, 1 Jun 2005, Mohit Kumar wrote:

> 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.
How does that provide clarity of code? If that is what you want,
merge libone.a libtwo.a (see ar) into a single archive and use it..

-ishwar

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-06-01 15:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-30 15:24 Statically linking a shared library to another library to be statically linked Mohit Kumar
2005-06-01  5:43 ` Fwd: " Mohit Kumar
2005-06-01 14:33   ` Ian Lance Taylor
2005-06-01  5:46 ` corey taylor
2005-06-01  9:09   ` Mohit Kumar
2005-06-01 15:33     ` Ishwar Rattan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).