From: Phoenix87 on
Hallo everybody

I want to build some shared libraries from C++ code defining classes
because I want to load them dynamically in programs that need that
classes. I've read about dlopen and co., which require the
implementation of factory procedures in order to dynamically allocate
class instances from the loaded shared object. Is there an alternative
way to dynamically load classes in C++ programs? I mean something
which allows to instantiate new class instances with new keyword
etc...Basically my question is quite the same thing as asking how the
STL, or the CERN ROOT libraries work.

Thanks in advice!

Gab.
From: Edgardo Portal on
On 2010-02-08, Phoenix87 <phoenix1987(a)gmail.com> wrote:
> Hallo everybody
>
> I want to build some shared libraries from C++ code defining classes
> because I want to load them dynamically in programs that need that
> classes. I've read about dlopen and co., which require the
> implementation of factory procedures in order to dynamically allocate
> class instances from the loaded shared object. Is there an alternative
> way to dynamically load classes in C++ programs? I mean something
> which allows to instantiate new class instances with new keyword
> etc...Basically my question is quite the same thing as asking how the
> STL, or the CERN ROOT libraries work.

I've used the Factory pattern with static factory class
methods, along the lines of:
http://www.faqs.org/docs/Linux-mini/C++-dlopen.html#loadingfunctions