> From: Carsten Neumann [mailto:carsten_neum...@gmx.net] 
> Sent: Wednesday, March 24, 2010 11:19
> To: opensg-users@lists.sourceforge.net
> Subject: Re: [Opensg-users] *RefPtr and exit() woes
>
> Hall, Theodore wrote:
> >> >From my perspective: I'm writing a DLL that (I hope) can be safely
> > loaded, unloaded, and reloaded multiple times from one process, meaning
> > multiple calls into osgInit() and osgExit().  If something isn't clean
> > at exit, I need to know about it.
>
> uhm, normally it is not possible to make multiple calls to 
> osgInit/osgExit. When osgExit runs it destroys objects that were created 
> as a side effect of static initialization (mainly type registration) and 
> unless there is a way to rerun that static initialization there is no 
> way these objects can be brought back to life.
> Does static init run for a second time if you reload a DLL (after 
> unloading it in the meantime)?


In a word, yes.

It seems to be working.

I have file-scope bool variables f_DidInit and f_DidExit, static-
initialized to false, and set to true after osgInit and osgExit return.

I just added another bool, f_KeepAlive, to specify whether or not
osgExit should be called.

I now have a DLL with a main-like program that initializes and runs
an OpenSG application.  I can load this with LoadLibrary(), execute
its main() multiple times, FreeLibrary(), LoadLibrary and repeat again.
It seems to be working.

-- 

Ted


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to