On free pascal static dynamic linker lazarus / 1-Linux ---------------------------------------------------------------------- benohb · 2018-04-02 08:41 I am really confused about FPC static/dynamic linker in linux .Maybe I'm wrong in understanding But I see it as illogical According to the wiki, Free Pascal comes by default "statically linked" with libraries this makes the program no longer needs external requirements..It is understandable http://wiki.freepascal.org/Size_Matters QuoteFPC compiles and links a static executable by default. That means it tells the linker to put all .o files of the project and all packages into one big executable. But why when you use the command "objdump" Example with fpgui Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i objdump ./customstyles_test | grep NEEDED    NEEDED               libX11.so.6  NEEDED               libXft.so.2  NEEDED               libfontconfig.so.1  NEEDED               libc.so.6  Note that still need external libraries and must be in the operating system What's going on ?? ---------------------------------------------------------------------- Thaddy · 2018-04-02 09:20 The libc I can understand but the X* stuff (that YOU wrote yourself) should not be there.... Happy Easter. ---------------------------------------------------------------------- benohb · 2018-04-02 09:29 The strange thing is here.. with fpgui library comes a file fpg_xft_x11.pas  it is static linkerd with libxft and libfontconfig I turned it dynamically Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i xfthlib:=LoadLibrary('/usr/lib/XXX-linux-gnu/libXft.so.2');pointer(Xft DrawCreate):=GetProcAddress(xfthlib,'XftDrawCreate');................. pointer(FcFontSetDestroy):=GetProcAddress(xfthlib,'FcFontSetDestroy'); //<------Note here The program runs without errors ..This is proof that libxft load libfontconfig Automatically I think the executable in Linux has become static/dynamic at the same time it makes the static linker without its Advantages ---------------------------------------------------------------------- Thaddy · 2018-04-02 09:42 That Is strange... Nice Easter puzzle... ---------------------------------------------------------------------- taazz · 2018-04-02 09:43 You misunderstood the range of linking. all code that is compiled by the FPC compiler is statically linked there is no dynamic link (yet?). FPGUI and lcl do not provide obj files for system libraries and choose to bind with them directly either statically or dynamically. A static bind is one that uses the extern type of linking and a dynamic binding is the one that use loadlibrary, getprocaddress etc procedures to bind to the libraries at runtime. Both are referred to as static/dynamic linking but they are different processes that is why I prefer to call the process of attaching to external libraries as binding instead of linking although the linker is responsible on both cases. So in short if the code is not compile by fpc then its probably a bind usually a static bind becoming. ---------------------------------------------------------------------- Thaddy · 2018-04-02 10:02 taazz: he wrote the bindings... you are probably using them every day. It is a puzzle... ---------------------------------------------------------------------- benohb · 2018-04-02 10:07 taazz ..Thank you