[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Dennis Payne wrote:
> > It is possible to load classes from a shared object using dlopen() and
> > friends. The trick is that using "new" probably won't work.
> I doubt using "new" would work. The way I do it in Troll Bridge is to
> have a C function that registers a new function like you have. That way
> if the C++ name mangling changes your code isn't affected.
I used to have a function in an 'extern "C"' block so that the name
wouldn't be mangled, but I then decided that I wanted to keep the type
safety and scoping (a static method inside a class isn't scoped global),
so I put it in a static method and kept the mangling.
Both way works.
Ludus Design, http://ludusdesign.com/
"First they ignore you. Then they laugh at you.
Then they fight you. Then you win." -- Gandhi