Shared Library - statisch gelinked?
-
Hallo Kollegen,
mit Referenz auf meinen Post in Linux/Unix Forum ( http://www.c-plusplus.net/forum/viewtopic-var-t-is-182971.html ), denke ich mal das die weiterführende Frage eher ins Compilerforum passt..Also folgendes:
http://publib.boulder.ibm.com/infocenter/pseries/v5r3/index.jsp?topic=/com.ibm.vacpp7a.doc/proguide/ref/compile_library.htmIn dem obigen Link der IBM Doku zur Erstellung von Shared Libraries gibt es 2 Methoden wie man Shared Libraries erstellen kann:
Compiling a shared library
To create a shared library that uses static linking:Compiling a shared library
To create a shared library that uses run-time linking:Nun bringen diese beiden Punkte mich etwas aus dem Konzept, da ich bisher immer dachte das eine Shared Library zur Runtime in mein Programm gelinked wird. (bzw. bei Benutzung erst geladen wird)
Wie ist es dann möglich das eine "shared library" statisches linken benutzen kann?
Ich verstehe das nicht
Gibt es hier noch eine besondere Art/Form der shared library.Alle Programme die ich bisher auf AIX gesehen habe, werden auch dynamisch gegen die libc.a gelinked (siehe meinen oben genannten Post im Linux Forum).
Die libc.a muss daher mit dem Verfahren "To create a shared library that uses static linking" erstellt worden sein, da es keine .so Datei sonder ein .a (Archiv) ist.Vielleicht weiss jemand von Euch worin der Unterschied der beiden Sharede Library Arten besteht.
Danke
-
Hallo,
habe jetzt selbst nach Lösungen gesucht und endlich eine Site gefunden die das Problem beschreibt.Quelle: http://www.iecc.com/linker/linker09.html
A much more interesting problem occurs when the library is present, but the library has changed since the program was linked. In a conventionally linked program, symbols are bound to addresses and library code is bound to the executable at link time, so the library the program was linked with is the one it uses regardless of subsequent changes to the library.. With static shared libraries, symbols are still bound to addresses at link time, but library code isn't bound to the executable until run time. (With dynamic shared libraries, they're both delayed until runtime.)
A static linked share library can't change very much without breaking the programs that it is bound to. Since the addresses of routines and data in the library are bound into the program, any changes in the addresses to which the program is bound will cause havoc.
Ok soweit verstanden aber was meint der Text mit:
In a conventionally linked program, symbols are bound to addresses and library code is bound to the executable at link time, so the library the program was linked with is the one it uses regardless of subsequent changes to the library.
Kann mich jemand vielleicht mal aufklären was es mit den Symbolen und Adressen aufsich hat?
Wäre super