I was reading the difference between dynamic loading and dynamic linking. (Dynamic loading vs Dynamic linking.) From there I found this useful answer by Jeff Darcy combination of linking and loading
In the third type i.e, Dynamic loading, dynamic linking where we use dlopen()
function to get a handle of that library and try to resolve the symbols. The object file is loaded dynamically under program control (i.e. after start), and symbols both in the calling program and in the library are resolved based on the process's possibly-unique memory layout at that time.
Can someone answer to the following questions:
How
dlopen()
open is different (advantageous) than other method of linking with shared library. For example: I have seen "libssl" is linked withdlopen()
.What advantages we will get it. Is this related to only library version control?
What does he mean by "symbols are resolved based on the process's possibly-unique memory layout at that time"