On 4/3/07, Adrian Egli <[EMAIL PROTECTED]> wrote:
hi

i like to implement for our application a plugin system. Which allows user
to implement their own plugins, dynamic libraries. I have some question
(conceptionals):

(1) If the user build against a elder OSG version, would the plugin still
run if we would change our OSG version, means the main application will
change the version, the plugin not. we will pass
     a pointer of osg::Node*. the node* is of version XXX.XXX.2   and the
plugin use version XXX.XXX.1 means an elder version. and the plugin just
knows the elder interface, it sould run, or i am wrong?

Mixing plugins and libs from different versions of the OSG is not
safe.  Manage your lib paths carefully to avoid this.


(2) under windows i can ask for a void* pointer to an function pointer, with
the handle and static name (string) is this a good choose, alos respect to
platform portability?

     example :
     ------------------------------------
    HMODULE module = LoadLibrary(dll_name.c_str());
    if ( module ){
        void* addr = (void*)GetProcAddress( module, "createDLL" );
        if ( addr ) {
            // Def. function parameters
            typedef void ( *CreateFn)( void* );
            CreateFn pfnCreate = (CreateFn) addr;
            pfnCreate(m_Object);
        }
    }

The OSG has osgDB/DynamcLibrary class for helping do cross platform
dynamic library management.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to