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

[ale] Compiling ssh



> Chris Fowler wrote:
> 
> I believe it is --staic.  But does that link the whole library,
> including functions that are not used?
> 

Only the necessary functions from the library will be linked into the
executable when linking statically. I believe that the --static
option tells GCC to link statically to all libraries, including
libc, so beware.

The easy way is to just explicitly specify an .so or a .a
depending on what you want done. On Linux, the linker (ld)
will accept both *.a and *.so files on the command line, which
means you can do:

gcc -o foo libfooUtils.a libfooDynamic.so foo.c

and get a "foo" executable that's dynamically linked to
libfooDynamic.so and statically linked to libfooUtils.a.

-- Joe Knapka
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.