5

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:

  1. How dlopen() open is different (advantageous) than other method of linking with shared library. For example: I have seen "libssl" is linked with dlopen().

    What advantages we will get it. Is this related to only library version control?

  2. What does he mean by "symbols are resolved based on the process's possibly-unique memory layout at that time"

Community
  • 1
  • 1
ppandey
  • 311
  • 2
  • 3
  • 9
  • 1
    A common use-case of `dlopen` is *modules*. It's commonly used by game or graphics engines to load renderers at runtime (DirectX versus OpenGL). – Some programmer dude Feb 20 '18 at 13:15
  • Possible duplicate of [What are the use cases of dlopen vs standard dynamic linking?](https://stackoverflow.com/questions/45388186/what-are-the-use-cases-of-dlopen-vs-standard-dynamic-linking) – ryyker Feb 20 '18 at 14:01
  • Hi @Someprogrammerdude.. If my understanding is correct then, Dynamic linking and Dynamic loading means that after compiling the code, symbol table has not filled the reference for the dynamic libraries. Once the process starts executing it attaches with the reference for that library and also load them dynamically (i.e, after process execution). Correct me if I am wrong. Now what may be the advantages of Dynamic loading, dynamic linking over Static loading, dynamic linking ? – ppandey Feb 22 '18 at 05:30

0 Answers0