Hi JP, Hi Robert,

2009/5/19 Robert Osfield <[email protected]>

> Hi Vincent,
>
> Looking at J.P. follow up email it does sound like it could be windows
> specific issue.  Are you using windows?

Yes

Is you singleton implemented in a header?

Yes..


> If so the just have the declaration in the header, and
> keep the implementation entirely within the .cpp to ensure that the
> allocation happens single dll.
>
> Robert.



I thinks the problem is here : I've a dll and an exe implementing the same
singleton (common sources but 2 compilations) ... so I get two instances,
that sounds logical.
Now I'm thinking a way to get only one ... maybe an other lib ?

In OSG sources this is not a problem : the core is a lib, the plugin is a
lib based on the core, and the application uses the core. so we can explain
the calls just on one single line... but me I've got a dll using an other
one, and the one in question implement the same code than the core using the
dll ... I can explain it making a triangle, with the exe, the exe code in
dll, and the dll... so the same code is implemented twice ... and so my
singleton too...

If you think of any solution, I would be very interested to hear it.

Thanks.

Regards,
   Vincent.



>
>
> On Tue, May 19, 2009 at 3:33 PM, Vincent Bourdier
> <[email protected]> wrote:
> > Hi Robert,
> >
> > I get more info : the singleton is not destroyed, but is called from the
> lib
> > I did and from the exe itself. When the lib call the singleton, it works
> > good. when the exe call the singleton, It does a new call to constructor
> ...
> >
> > Any idea about how to solve that problem ?
> >
> > Thanks.
> >
> > Regards,
> >    Vincent.
> >
> > 2009/5/19 Robert Osfield <[email protected]>
> >>
> >> On Tue, May 19, 2009 at 2:24 PM, Vincent Bourdier
> >> <[email protected]> wrote:
> >> > Hi Robert,
> >> >
> >> > I think I get it :
> >> >
> >> > I seems to be due to the osgDB::DynamicLibrary instance I use, which
> >> > ref_ptr
> >> > unref when leaving the load code, so the destructor of the
> >> > RegisterReaderWriterProxy (my equivalent) was called, and it seems to
> be
> >> > sufficient to force a new call to the Registry constructor.
> >> >
> >> > Does it sounds right for you ?
> >>
> >> I can't comment on code I'm not party to.
> >>
> >> As a general note one shouldn't be able to delete a internally
> >> singleton used in my example without doing a instance()=0;  Just take
> >> a ref_ptr<> to the return won't delete the object as the instance()
> >> method keeps around a copy.
> >>
> >> Robert.
> >> _______________________________________________
> >> osg-users mailing list
> >> [email protected]
> >>
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to