Hi CMake/build experts,

I am currently looking at the static build of the OSG, and in
particular the problems with static libraries only including .o's that
have symbols that are explictly referenced in the main, or one of the
objects referenced by main.  The problem with this is that the OSG
uses proxy objects to register items like the DotOsgWrappers that
implement the .osg functionality for each of the OSG classes, and
these proxy objects are designed to facilitate loose coupling to make
extensibility more pratical, but it's so loosely coupled that no
external symbols are required which is fine until need to do static
linking, then all these proxy's never get compiled in.

I have a fix for the .osg plugin since in Lilinx which involves
creating a dummy function all all the plugins .cpp's and have the
ReaderWriterOSG.cpp explictly call all these dummy functions.  This
scheme works, but it really breaks the key advantage of loose coupling
that is what use of proxy object construction is all about, so it'll
make the code less easy to maintain, and more prone to bugs.

So... I'm looking for a better solution.  Added a C++ symbols to .o's
is possible, but you can't link to these externally unless you do the
compiler specific name mangling, but if we use extern C defined
functions then name mangling won't be an issue.  My thought was
perhaps we could define a C function with a name based on the name of
the file, then have the build system somehow declare to the build that
sybmol is required.  So ReaderWriterOSG.o would require Node.o,
Group.o etc from the .osg plugin, and then any static viewer code
would pull in the ReaderWriterOSG symbol and everything else with it.

Is this idea possible with compilers?  Is it possible with CMake?

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to