HI Lilinx,

I've reviewed your changes and rather than integrate, have implemented
some similar, but a little more streamlined.  I have added two extra
macros to include/osgDB/Registry.  In the indivudal DotOsgWrapper
implementations the proxy is now constructed (along with a C function)
using the macro REGISTER_DOTOSGWRAPPER(name):


// register the read and write functions with the osgDB::Registry.
REGISTER_DOTOSGWRAPPER(Node)
(
    new osg::Node,
    "Node",
    "Object Node",
    &Node_readLocalData,
    &Node_writeLocalData
);


And these symbols are pulled in using USG_DOT_OSGWRAPPER(name)'s in
the ReaderWriterOSG.cpp:

// pull in symbols from individual .o's to enable the static build to work
USE_DOTOSGWRAPPER(AlphaFunc)
USE_DOTOSGWRAPPER(AnimationPath)
..

This scheme avoids the need of declaring and calling functions twice
in ReaderWriterOSG.cpp, and avoids some duplication that would have
otherwise been added to indivual DotOsgWrapper files.  Naming is also
consistent with the REGISTER_PLUGIN/USG_PLUGIN macros that I earlier
introduced.

I've been testing with osgstaticviewer and I'm able to load cow.osg
and other .osg models.  All my changes are now checked into svn/trunk.
 Could you try out the svn version of the OSG to see if everything is
hanging together OK.

If things look sound then we'll need to migrate the other NodeKit .osg
wrapper plugins across to using this scheme, as well as do something
similar in the OpenFlight plugin.  I can't personally tackle this
right now as I have lots of other work to catch up on, so any effort
in this direction would be appreciated.

Cheers,
Robert.

On Tue, Dec 9, 2008 at 11:36 AM, xll <[EMAIL PROTECTED]> wrote:
>
> hi, all
>        when I use static lib of  osg plugin (osgdb_osg_s.lib), I find that
> the global vars in others cpp
> file exclude ReaderWriteOSG.cpp  are not  inited .  It is relate to the
> linker because we don't use
> every thing in that cpp file, then the linker don't link every thing
> (funtions, global vars) in that cpp file
> to the final application.
>          So I add  the following code to osgdb/registry
>
> //define dummy function
> #define DEF_DUMMYFUN(number) extern inline void Dummy_Function##number(){}
> //declare dummy function
> #define DEC_DUMMYFUN(number) extern inline void Dummy_Function##number();
> //call dummy function
> #define CAL_DUMMYFUN(number) Dummy_Function##number();
>
> Then , in each cpp file include global var , I add a macro
> DEF_DUMMYFUN(number),
> and in   ReaderWriteOSG.cpp  , add  some code in
>           #ifdef OSG_LIBRARY_STATIC
>              ..........
>           #endif
> to call the dummy function.
>
> Now, the final app will init each global var before our main function
> calling when using static lib.
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to