From: Dirk Gregorius (dirk_at_[hidden])
Date: 2004-12-08 13:05:32
> extern "C" Interface* DLLCreate()
> return new InterfaceImpl;
> extern "C" void DLLDestroy( Interface* p )
> delete p;
> and then construct an InterfacePtr( DLLCreate(), DLLDestroy ). You'll
need a public virtual destructor in this case,
I changed to this:
void DLLCreate( Interface& rInterface )
// Implementation option #1:
rInterface.reset( new InterfaceImple );
// Implementation option #2:
rInterface = InterfacePtr( new InterfaceImpl );
Is this a valid solution as well? At least it compiles - but with the
first solution I have the feeling that I could run into the boundary
problem, since the actual pointer is not constructed on the DLL side.
But as I said - I can only guess here...
Is there a difference between both solutions?
> Yes, it's allowed. Since you are using the DLL runtime, you probably
don't need to interoperate with different C++
> compilers so you probably need to just omit the extern "C" from
But how can I load the function than after it got mangled?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk