Robert Osfield wrote:
Hi Philip,

What you are doing is along way off designed usage of the OSG, but the
OSG being just C++/OpenGL is "should" be possible.  The problem you
probably have is down to a order issue with unloading of libraries -
start by unloading all the plugins (use osgDB for this), then the next
highest OSG library in the depdency chain till you get down to the
unloading the core OSG itself.

Robert,

You're absolutely correct.  Simply calling
   osgDB::Registry::instance()->closeAllLibraries();
within the plugin using OSG fixes the dlclose() problem.

Does dlclose() not call the destructors of singletons like osgDB::Registry? It doesn't look like it does, at least not within OSG.

Since adding this in our plugin seemed less than optimal, I tested some code to use the __attribute__((destructor)) method documented in the dlclose manpage to call closeAllLibraries() and the other methods within osgDB::~Registry() as an extern'd function in Registry.cpp. I got the special function to execute on dlclose() but unfortunately my code was still segfaulting (although with a completely different backtrace).

I don't think what we're doing is anything remarkable. It's just taking advantage of OSG's well architected design to do terrain lookups as opposed to relying on proprietary libraries and databases to do so. Using OSG as a plugin here makes perfect sense to me. :)

--
Philip Lowman
Simulation Development Engineer, Modeling and Simulation Technology
General Dynamics Land Systems
http://www.gdls.com
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to