Hi all,

thinking for hours and digging my problem, I have a choice to make, but I
think some external advices could be useful :

I you need to load dynamically some DLL (as osg plugins) but theses DLL have
no similar I/O (so make each one inherit from a base class have no sense),
how will you do ?

I'm thinking in the calssical loadLibrary and getProcAdress for each one,
... but if you know or think in an other solution, I would be very
interested to hear it.

Thanks.

Regards,
   Vincent

2009/5/14 Vincent Bourdier <vincent.bourd...@gmail.com>

> 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 <arti_t...@yahoo.de>
>
> 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
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to