Re: Creating a statically linked executable using a dynamic library?

From: Gary R. Hook (nospam_at_nospammers.net)
Date: 10/30/03


Date: Thu, 30 Oct 2003 16:27:00 GMT

David R. Panhamer wrote:
> Hi everyone,
> Is it possible to take a dynamically link shared library (.so) and link it
> into a statically linked executable, so I don't need to distribute the
> libraries?

You can statically incorporate shared modules by using the
-bstatic/-bdynamic linker options. Note that statically linked
executables that include system libs are not portable nor
binary compatible, and should not/can not be moved from system
to system. The AIX system API is at the libc/libpthreads layer.
If you want to avoid distributing shared modules, statically link
on only those modules over which you have control. Thus, you'll
want to specify -bdynamic at the end of your command line; this
should allow system libs to remain dynamic.

-- 
Gary R. Hook / AIX PartnerWorld for Developers / These opinions are MINE
________________________________________________________________________