Hi Art,

This is not the same thing ?

Case 1 :
static variable in the dll, calling the register -> add on declaration. when
the dll is loaded, the static member is initialized, so the register call
the dll variable constructor and add it on its available dll stack (see
RegisterReaderWriterProxy implementation)

Case 2:
in the dll constructor I call the registry->intance()::register(this) which
does the same thing :stack the dll.

Thanks,
   Vincent.

2009/5/14 Art Tevs <[email protected]>

> Hi Vincent,
>
>
> Vincent.B wrote:
> > Okay, so I implement a myClass in the core, and I declare a static
> myClass mycalss in my DLL.
> >
> > so, I can call with the static implementation, the methods I want in the
> DLL from my core.
> >
>
> Not really, you implement a static/global variable, which will then
> initialize your class. Here is a code example, which is a standard C++ and
> it will initialize your objects when loading the dll:
>
> Code:
>
>
> #include <Registry>
>
> class myClass
> {
>   myClass()
>   {
>        Registry::registerMe(this);
>   }
> };
>
> static myClass g_myclass;
>
>
>
>
> This should be almost enough to achieve what you want.
>
>
> >
> > A last point I would like to understand :
> >
> > in each plugin, there is the "magic" :
> > REGISTER_OSGPLUGIN(...)
> >
> > #define REGISTER_OSGPLUGIN(ext, classname)
> >     extern "C" void osgdb_##ext(void) {}
> >     static osgDB::RegisterReaderWriterProxy<classname>
> g_proxy_##classname;
> >
>
> So as you see REGISTER_OSGPLUGIN do exactly the same, what you can see from
> the code above.
>
> What is this extra function osgdb_ext(){} good for, I do not know. Maybe
> the idea was to implement some extra procedures inside of the dll, so that
> they could manually be called when loading the dll.
>
> cheers,
> art
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=12093#12093
>
>
>
>
>
> _______________________________________________
> 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