Is it possible to define a pointer to a constructor?

I am using an explicitly linked shared library (loading shared lib c dlopen) to implement the C ++ plugin template.

Is it possible to define a pointer to the constructor of a class defined in the shared library, or would I need to define a factory method within the shared lib library that will create (and initialize) the class object from the shared lib? Of course, in my main application, I would define a pointer to a factory method, and that method would return an instance of the class that I need.

Greetings

+3
source share
2 answers

: , .

dlopen c- , , .

+6

dlsym(). - , . , , , extern "C" {...}, factory .

+1

Source: https://habr.com/ru/post/1780203/


All Articles