Hi,
there is a kind of example in OpenSG/Examples/AXPlugin/main.cpp in the
initializeStatics() method. That's not nice but it works.
Andreas
Hi Martin,
On Thu, 2005-08-18 at 14:38 +0200, [EMAIL PROTECTED] wrote:
Hi,
I want to use OpenSG as a static lib to link to my program. I managed to
compile BaseLib and SystemLib statically in VS7. Therefore I changed the
runtime library to multithreaded-debug and removed every OSG_BUILD_DLL
macro from the project. The libs build fine and I can link to it. But
whenever I want to read an image or load an object from a vrml file the
app crashes. I managed to follow the crash to this line:
bool ok = ImageFileHandler::the().read(iPtr, fileName);
in bool Image::read(const Char8 *fileName)
in the file osgimage.cpp
Same with the SceneFileHandler. Is there a way to fix this? What's going
wrong anyway? I know, it must have something to do with the static
linking, cause when I link to the DLLs my code works fine. Do I have to
add a hidden linker flag or some another macro definition?
The basic problem is that the linker is too smart. We use static C++
objects quite a bit that register themselves with a factory when they
are instantiated. But a smart linker can see that none of the symbols
from that object file are used anywhere else in the program, and
conclude that the object file is not needed. The workaround is to
manually touch a symbol from the object file, which will force the
object file to be linked, which will in turn create the static object,
which can then register itself with the factory.
I'm not sure how to prevent this. I've just skimmed through the
Microsoft compiler docs, and the thing you can try is removing the -ZI
flag from the compiler options and recompile. Relinking is probably not
enough. But that is just a shot in the dark, if that doesn;t help I
don't know what to do.
Sorry
Dirk
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users