Hello all,

I have tried to build OSG 1.1 in static configuration with VC8.
It worked well until I tried to link some static built plugins.

If we take ive plugin
It seems that the global:

RegisterReaderWriterProxy<IVEReaderWriter> g_IVEReaderWriterProxy;

is deadcode stripped because there is no reference to it in the application.
So the ive ReaderWriter is never registered.

To solve the problem

1) I added this code to ReaderWriterIVE.cpp :

#ifdef OSG_LIBRARY_STATIC
void* RegisterIVE()
{
   return (void*)&g_IVEReaderWriterProxy;
}
#endif //OSG_LIBRARY_STATIC

2) I called this function from the application
This prevents g_IVEReaderWriterProxy from being deadcode stripped and things work well.

Is there another way to avoid that kind of deadcode stripping (I know for example that there is a specific pragma in some compilers, but I didn't find anything in VC8) ? If not, I am sure there is a more elegant way to implement my trick but I think that this could be an easy way to allow true use of the OSG static build with a minimum of change to the code and keeping the spirit of the plugins.

I would be interested in having your feedback.

Regards,

Guillaume





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

Reply via email to