Then 'demo' will use Plugins.Call to
- retrieve an access to a symbol in the dynamic library using the dlsym() routine.
Plugins.Call is the only subprogram which calls dlsym. Now:
In short: It works, but I don't know why. How can a function from a library, loaded at run time, be called without using dlsym?
Finally I understood the scheme.
The trick is that the main program never calls plugin's functions! It only loads the plugin (libraries) with dlopen.
All plugins are descendents of an abstract base type, and each plugin has 2 global variables declared in its package body:
The respective overriding Initialize procedure:
The main program can call then all the object's methods, which it knows from the abstract base type.
So in short, the plugin generates an object when the library is loaded, and the main program acts like "We won't call you, call us."