On Thursday 17 August 2017 00:50:29 fredvs wrote:
> Hello.
>
> I am not sure about the terminology but let'say:
>
> - Staticaly Linking = use libX11.so = store some data in ELF, more safe...
>
> - Dynamicaly Linking = use libX11.so.6 = more freedom, can use dynlib....
>
AFAIK statically linking means that the library code is included in the 
executable normally by linking *.o or *.a files at compile time.
If one uses *.so's that means "shared linking" -> the library code is not 
contained in executable but loaded from target system at runtime.
There are two versions of shared linking, "statically shared" and "dynamically 
shared" (the terms vary).

With "statically shared" the linker at compiletime gets the "SONAME" of the 
given library, stores it in the executable and looks up the function 
references and sets table entries in the executable accordingly, which are 
resolved at runtime at startup by the linking loader of the target system.
That method is used by "xlib.pp". The executable can not start, if the needed 
*.so (defined by "SONAME") is not installed on the target system.
It can not be compiled, if the given library filename is not installed in the 
building system. I don't understand why FPC uses the version-less library 
names instead of the mayor version names where the bindings are made for. 
Maybe a misunderstanding happened at ancient times...

Example:
xlib.pp has the libraryname "X11" -> the searched file at compiletime 
is "libX11.so". On my system this is a link
libX11.so -> libX11.so.6 -> libX11.so.6.3.0.
"
objdump -p libX11.so.6.3.0 | grep SONAME
"
Shows
"
  SONAME               libX11.so.6
"
-> the file searched at runtime startup is "libX11.so.6".
http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

"Dynamically shared" on the other hand is completely handled at runtime, in 
MSEgui applications normally by the functions in "msedynload.pas", especially 
initializedynlib(), which accepts a list of possible library filenames, a 
list of needed procedure-names/variables and a list of optional 
procedure-names/variables.
initializedynlib() internally uses dlopen() and dlsym() of the target system.
With this method the application can start even if the needed libraries are 
not installed in the target system.
http://tldp.org/HOWTO/Program-Library-HOWTO/dl-libraries.html

Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to