Hi. Ok, I wouldn't call it a solution, but at least some kind of a work- around:
As I already thought, the initialization fails for the complete GLUTWindow part and getPrototype returns NullFC in the plugin. If I add a (non-sense) GLUTWindow::create in one of the classes of my System.dll, it works in the plugin, too afterwards. Looks like a weird linker issue, so if anybody has a suggestion for a cleaner solution (enabling a magic flag somewhere in the properties) please let me know. Thanks, Dominik Am 05.05.2008 um 11:03 schrieb Dominik Rau: > Hi. > > Currently, I'm doing a lot of refactoring / reimplementation on my > software system. One of the tasks among others is porting the beast to > windows - and that's giving me serious headaches - maybe one of the > more > windows experienced of you can give me a hint here. > > Let me shortly sketch my architecture: > I have a program, that uses 2 dlls, called Common.dll (doesn't use > OpenSG at all) and System.dll (this one does) that are used by the > main > program. While System defines most of the (graphics related) > framework, > all the functionality is encapsulated in plugins that are loaded at > runtime using dlsym on Linux / LoadLibrary on Windows. For example, > there are abstract Display and DisplayImp classes defined in the > System.dll and a derived SimpleSceneManagerDisplay class > implemented as > a plugin (Display_simpleSceneManager.dll). > > Everything works perfectly on Linux, but on Windows (using MSVC2005 > Professional, and a 1.8 daily build) the following happens: > > If I add OSG::GLUTWindow::create() in a class of my System.dll, it > returns a valid WindowPtr. But if I use the same call in my plugin, it > returns NullFC. I use the same compiler / linker options for both > (attached the debug versions below). Both calls are done in the > same thread. > > * Under what circumstances returns OSG::GLUTWindow::create() null? > After > looking into the code, the create call copies a prototype and > returns it > - when can that go wrong? > * Is there anything to consider when using OpenSG in a dll that is > loaded via LoadLibrary? Has anybody had problems with that before? > > I also have a second plugin (Scene_default.dll) that does the > following > in its constructor: > > _transform = OSG::ComponentTransform::create(); > _sceneRootNode = OSG::Node::create(); > beginEditCP(_sceneRootNode); > _sceneRootNode->setCore(_transform); > _sceneRootNode->addChild(OSG::makeTorus(1.5,2,32,32)); > endEditCP(_sceneRootNode); > > But here, I get valid NodePtrs for _transform and _sceneRootNode, so I > doubt that this is a general "::create" problem. osgInit is called > before loading the plugins in the System.dll. But moving it to the > display plugin had no effect either so this is propably not the cause. > Ah, and of course, the Tutorials all work fine, so GLUT and all > that is > obviously working. The compiler / linker options are copied from > one of > the tutorials (except that .exe was changed to .dll). > > Any ideas? > > Thanks in advance, > Dominik > > --------------------------------------------- > > MSVC Compiler/Linker options: > > Compiler System.dll: > /Od /I "C:\Libs\xerces-c_2_8_0-x86-windows-vc_8_0\include" /I > "C:\Libs\boost_1_34_1" /I "C:\Libs\OpenSG\include" /I "(lots of > includes)" /D "WIN32" /D "INTERNAL_SYSTEM" /D "LOGLEVEL=5" /D > "_WINDOWS" > /D "WINVER=0x0400" /D "_WIN32_WINDOWS=0x0410" /D "_WIN32_WINNT=0x0400" > /D "_OSG_HAVE_CONFIGURED_H_" /D "OSG_BUILD_DLL" /D "_DEBUG" /D > "OSG_DEBUG" /D "OSG_WITH_GLUT" /D "OSG_WITH_GIF" /D "OSG_WITH_TIF" /D > "OSG_WITH_JPG" /D "_WINDLL" /D "_MBCS" /Gm /EHsc /RTC1 /MDd / > Fo"Debug\\" > /Fd"Debug\vc80.pdb" /W1 /nologo /c /ZI /TP /errorReport:prompt > > Compiler Display_simpleSceneManager.dll > /Od /I "C:\Libs\xerces-c_2_8_0-x86-windows-vc_8_0\include" /I > "C:\Libs\boost_1_34_1" /I "C:\Libs\OpenSG\include" /I "(lots of > includes)" /D "WIN32" /D "LOGLEVEL=5" /D "_WINDOWS" /D "WINVER=0x0400" > /D "_WIN32_WINDOWS=0x0410" /D "_WIN32_WINNT=0x0400" /D > "_OSG_HAVE_CONFIGURED_H_" /D "OSG_BUILD_DLL" /D "_DEBUG" /D > "OSG_DEBUG" > /D "OSG_WITH_GLUT" /D "OSG_WITH_GIF" /D "OSG_WITH_TIF" /D > "OSG_WITH_JPG" > /D "_WINDLL" /D "_MBCS" /Gm /EHsc /RTC1 /MDd /Fo"Debug\\" > /Fd"Debug\vc80.pdb" /W1 /nologo /c /ZI /TP /errorReport:prompt > > Compiler Scene_default.dll > /Od /I "C:\Libs\xerces-c_2_8_0-x86-windows-vc_8_0\include" /I > "C:\Libs\boost_1_34_1" /I "C:\Libs\OpenSG\include" /I "(lots of > includes)" /D "WIN32" /D "LOGLEVEL=5" /D "_WINDOWS" /D "WINVER=0x0400" > /D "_WIN32_WINDOWS=0x0410" /D "_WIN32_WINNT=0x0400" /D > "_OSG_HAVE_CONFIGURED_H_" /D "OSG_BUILD_DLL" /D "_DEBUG" /D > "OSG_DEBUG" > /D "OSG_WITH_GLUT" /D "OSG_WITH_GIF" /D "OSG_WITH_TIF" /D > "OSG_WITH_JPG" > /D "_WINDLL" /D "_MBCS" /Gm /EHsc /RTC1 /MDd /Fo"Debug\\" > /Fd"Debug\vc80.pdb" /W1 /nologo /c /ZI /TP /errorReport:prompt > > > > Linker System.dll: > /OUT:"C:\Dokumente und Einstellungen\iod\Eigene > Dateien\4DActor2\4DActor2\4DActor2Win\Debug\System.dll" /NOLOGO > /LIBPATH:"C:\Dokumente und Einstellungen\iod\Eigene > Dateien\4DActor2\4DActor2\4DActor2Win\Debug" > /LIBPATH:"C:\Libs\boost_1_34_1\lib" /LIBPATH:"C:\Libs\OpenSG\lib" /DLL > /MANIFEST /MANIFESTFILE:"Debug\System.dll.intermediate.manifest" / > DEBUG > /PDB:"c:\Dokumente und Einstellungen\iod\Eigene > Dateien\4DActor2\4DActor2\4DActor2Win\debug\System.pdb" /MACHINE:X86 > /ERRORREPORT:PROMPT Common.lib OSGBaseD.lib OSGSystemD.lib > OSGWindowGLUTD.lib glut32.lib glu32.lib opengl32.lib tif32.lib > libjpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib > comdlg32.lib > advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib > odbccp32.lib > > Linker Display_simpleSceneManager.dll > /OUT:"C:\Dokumente und Einstellungen\iod\Eigene > Dateien\4DActor2\4DActor2\4DActor2Win\Debug > \Display_simpleSceneManager.dll" > /NOLOGO /LIBPATH:"C:\Dokumente und Einstellungen\iod\Eigene > Dateien\4DActor2\4DActor2\4DActor2Win\Debug" > /LIBPATH:"C:\Libs\boost_1_34_1\lib" /LIBPATH:"C:\Libs\OpenSG\lib" /DLL > /MANIFEST > /MANIFESTFILE:"Debug > \Display_simpleSceneManager.dll.intermediate.manifest" > /DEBUG /PDB:"c:\Dokumente und Einstellungen\iod\Eigene > Dateien\4DActor2\4DActor2\4DActor2Win\debug > \Display_simpleSceneManager.pdb" > /MACHINE:X86 /ERRORREPORT:PROMPT Common.lib System.lib OSGBaseD.lib > OSGSystemD.lib OSGWindowGLUTD.lib glut32.lib glu32.lib opengl32.lib > tif32.lib libjpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib > comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib > odbc32.lib odbccp32.lib > > Linker Scene_default.dll > /OUT:"C:\Dokumente und Einstellungen\iod\Eigene > Dateien\4DActor2\4DActor2\4DActor2Win\Debug\Scene_default.dll" /NOLOGO > /LIBPATH:"C:\Dokumente und Einstellungen\iod\Eigene > Dateien\4DActor2\4DActor2\4DActor2Win\Debug" > /LIBPATH:"C:\Libs\boost_1_34_1\lib" /LIBPATH:"C:\Libs\OpenSG\lib" /DLL > /MANIFEST /MANIFESTFILE:"Debug > \Scene_default.dll.intermediate.manifest" > /DEBUG /PDB:"c:\Dokumente und Einstellungen\iod\Eigene > Dateien\4DActor2\4DActor2\4DActor2Win\debug\Scene_default.pdb" > /MACHINE:X86 /ERRORREPORT:PROMPT Common.lib System.lib OSGBaseD.lib > OSGSystemD.lib OSGWindowGLUTD.lib glut32.lib glu32.lib opengl32.lib > tif32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib > advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib > odbccp32.lib > > > > ---------------------------------------------------------------------- > --- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save > $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http:// > java.sun.com/javaone > _______________________________________________ > Opensg-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/opensg-users ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Opensg-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensg-users
