help-gplusplus
[Top][All Lists]
Advanced

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

Re: make shared library( .so )


From: Robert Heller
Subject: Re: make shared library( .so )
Date: Sat, 03 Feb 2007 21:06:07 +0100

At Sat, 03 Feb 2007 06:54:43 -0800 Paul Pluzhnikov 
<ppluzhnikov-nsp@charter.net> wrote:

> 
> ravindra.csd@gmail.com writes:
> 
> > i want to make .so from multiple .a's
> 
> On which platform?
> 
> On Linux you can do this:
> 
>   # combine libbar.a and libbaz.a into libfoo.so
>   g++ -fPIC -shared -o libfoo.so -Wl,--whole-archive -lbar -lbaz 
> -Wl,--no-whole-archive
> 
> On non-GNU-ld platforms you have to "explode" the archives:
> 
>   mkdir tmp.$$ && cd tmp.$$ &&
>   ar x ../libbar.a && ar x ../libbaz.a &&
>   g++ -fPIC -shared -o ../libfoo.so *.o && 
>   cd .. && rm -rf tmp.$$
> 
> Cheers,

The only gotcha is whether or not the modules in the lib*.a files where
compiled with -fPIC or not (and whether that matters).

Also: be careful to be sure that if the lib*.a files contain C++ code
that both where built with  the same version of the same C++ compiler.


-- 
Robert Heller             -- 978-544-6933
Deepwoods Software        -- Linux Installation and Administration
http://www.deepsoft.com/  -- Web Hosting, with CGI and Database
heller@deepsoft.com       -- Contract Programming: C/C++, Tcl/Tk
                                                                     


reply via email to

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