Hi all,

I've just spent some hours running into the osgDB code, and some littles
things are more clear but there is the big question I cannot answer :

The method
DynamicLibrary::PROC_ADDRESS DynamicLibrary::getProcAddress(const
std::string& procName)

is for me the only one which the loader must use each time a plugin dll have
to be loaded.
But, there is no utilization, at no place ! So how can the osgDB core find
the good methods in the dLL without using this method ?
I'm not a c++ master, but for now, I feel lost in the c++ myst ...

Thanks.

Regards,
   Vincent.


2009/5/13 Vincent Bourdier <[email protected]>

> Hi Ismail,
>
> Not sure to understand all you explained, I didn't find a simple answer to
> my questions.
> I know that the getProcAdress return a void*, but I was asking about the
> osg getProcAdress, and if is there any way different than the cast to get
> the function usable ... and to know how this is used in the plugins because
> I didn't found any code using it.
>
> Thanks.
>
> Regards,
>    Vincent.
>
> 2009/5/13 Ismail Pazarbasi <[email protected]>
>
> On Wed, May 13, 2009 at 9:47 AM, Vincent Bourdier
>> <[email protected]> wrote:
>> > Hi all,
>> >
>> > I'm currently making a dynamic lib for my application, and so I use the
>> > osgDB::DynamicLibrary class to load the lib and find the Proc_adress
>> but,
>> > there are some points I would like to understand more :
>> >
>> > 1.
>> > The osgDB::DynamicLibrary::PROC_ADDRESS is just a void* so to use the
>> adress
>> > as a function as expected, I need to cast it :
>> >
>> >
>> >     typedef int        (*Pupdate)    (const char* path, const char* id,
>> bool
>> > first_time);
>> >     Pupdate update;
>> >     update = (Pupdate) dll->getProcAddress("update");
>> >
>> > If I do not cast, the compiler do not want to use a void* when I call
>> the
>> > function next...
>> >
>> > It is the behavior/use you were expecting when writing this class ? or
>> is
>> > there someting else to use, avoiding the cast ...
>> > A little precision : this code have to work on every osg supported
>> > plateform. (win and linux at least)
>> >
>> >
>> > 2.
>> > Next, I just have red a lot of code on osgDB, writers, plugins ... etc
>> but I
>> > didn't found the rela "connection" between the osgDB core and the
>> plugins.
>> >
>> > What I've understood is :
>> > The core, using the file termination, load the DLL (if exists).
>> > But the getProcAdress is never used ... so how did the core call the dll
>> > read/write function without the ProcAdress ?
>> >
>> >
>> > Any help would a very apreciated :-)
>> >
>> > Thanks.
>> >
>> > Regards,
>> >    Vincent.
>> >
>> >
>> > _______________________________________________
>> > osg-users mailing list
>> > [email protected]
>> >
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>> >
>> >
>>
>> Hi Vincent,
>>
>> void* is accepted form of an address in memory. getProcAddress returns
>> address of a symbol in the dynamic library and it (the underlying
>> implementation) doesn't care how exported symbol looks like (i.e.
>> types), nor knows what will that address be used for. There may be
>> implementations around (IIRC, with boost::function and boost::bind)
>> but it may be too complicated and doesn't simplify your job anyway.
>>
>> Ismail
>> _______________________________________________
>> 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