On Friday 08 September 2017 23:40:38 fredvs wrote:
> Hello Martin.
>
> Did you know that you may combine static + dynamic linking?
>
> I mean, take the advantage of static linking (adding some infos about the
> library in ELF, more safe, ...)
> and take the advantage of dynamic linking (using fast libdl.so library,
> change name/dir of the lib, etc ...).
>
I fear you still use the wrong terms. "static linking" means to link the 
binary code of *.o and *.a files at compile time where the library code 
becomes a fix part of the executable.
"dynamic" or "shared" linking on the other hand links *.so files of the target 
system at runtime. It comes in two flavors, either loading by ld-linux.so.2 
using link information stored in executable by "ld" or by explicit calls of 
dlopen()/dlsym() in user code.
It would be a surprise if dlopen()/dlsym() would be faster than ld-linux.so.2 
because the latter can use optimized tables. Another advantage of 
ld-linux.so.2 is that it is possible to list the needed libraries by "ldd 
<executable>".
MSEide+MSEgui for example uses both, ld-linux.so.2 for mandatory libraries, 
dlopen()/dlsym() for libraries which are used for extensions or specific 
components only which are loaded on demand (database-, audio-, math-... 
libraries).

> For example in dynamic X11 header add this:
>
> ---> Procedure dummy() ; cdecl; external libX11;
>
> Because of the use of "external", fpc will add -lX11 for the linker and
> then the lib infos in ELF.
>
> in link.res --->
>
> INPUT(
> -ldl
> -lX11  -->  This was added by "external"
> )
>
or by a {$linklib} statement.

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