D
Daniel Luis dos Santos
Hello,
I have a piece of code that relies on a dynamic library for
implementing specific functionality. In other words, the first piece of
code supports plugging in the other library. To do that I am using the
dlopen api.
I want to make the loading of the code obey a class interface from
which all plugins should derive.
As usual in this situation I have one C function that creates instances
of the plugin class, and another one for calling their destructor.
Problem is that, when I get the function that creates the instances
(using dlsym), there is no way of knowing if it conforms to the agreed
signature, mainly if the returned object is a descendent of the plugin
class. What can I do to enforce this ?
I have a piece of code that relies on a dynamic library for
implementing specific functionality. In other words, the first piece of
code supports plugging in the other library. To do that I am using the
dlopen api.
I want to make the loading of the code obey a class interface from
which all plugins should derive.
As usual in this situation I have one C function that creates instances
of the plugin class, and another one for calling their destructor.
Problem is that, when I get the function that creates the instances
(using dlsym), there is no way of knowing if it conforms to the agreed
signature, mainly if the returned object is a descendent of the plugin
class. What can I do to enforce this ?