help-gplusplus
[Top][All Lists]
Advanced

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

Re: how to link / build static libs to a shared object library


From: Paul Pluzhnikov
Subject: Re: how to link / build static libs to a shared object library
Date: Sun, 18 Feb 2007 11:22:25 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

"g" <george13p@yahoo.com> writes:

> I have three static libs, A.a, B.a, C.a and I want to create a shared
> lib D.so.

Please read this:
  http://www.catb.org/~esr/faqs/smart-questions.html

> which are the appropriate flags to do this?

Depends on the OS and which linker you are using.
On Linux, do this:

  g++ -shared -o D.so -Wl,--whole-archive A.a B.a C.a -Wl,--no-whole-archive

Note that on many processors, code in A.a, B.a etc. must be compiled
with -fPIC, or you'll not be able to link it into a shared library.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]