On Wed, May 13, 2009 at 9:47 AM, Vincent Bourdier <vincent.bourd...@gmail.com> 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 > osg-users@lists.openscenegraph.org > 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 osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org