RE: unable to link to a static library present alongside a shared library

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

 



Hi,

You can use the '-static' option to gcc for forcing a static link even
if a shared library is present.
I think the default behaviour is set so as to take advantages of shared
library. For example, a dynamically linked executables has smaller size
than their corresponding statically linked files. While executing
multiple programs dynamically linked to a shared library, there will be
only one instance of that particular library in the memory for serving
all the programs that use it.

Hope that was helpful.

Regards,
Cyon P.J.

-----Original Message-----
From: linux-c-programming-owner@xxxxxxxxxxxxxxx
[mailto:linux-c-programming-owner@xxxxxxxxxxxxxxx] On Behalf Of
Shriramana Sharma
Sent: Wednesday, April 18, 2007 5:39 PM
To: linux-c-programming@xxxxxxxxxxxxxxx
Subject: unable to link to a static library present alongside a shared
library

I read recently that someone was not able to link statically to a
library which was placed alongside a shared library. Having gained some
knowhow from the good people on this list I checked first the ld manpage
and found this:

ld will search a directory for a library with an extension of .so before
searching for one with an extension of .a.

Does anyone know of a way to subvert this behaviour and force linking to
the static library?

Also, why is this behaviour made this way? Is there a reason or is it
arbitrary?

Thanks as ever, for all your help.

Shriramana Sharma.
-
To unsubscribe from this list: send the line "unsubscribe
linux-c-programming" in the body of a message to
majordomo@xxxxxxxxxxxxxxx More majordomo info at
http://vger.kernel.org/majordomo-info.html
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux