Comment on the declspecs:

Looking at that it seems as if OSG_BUILD_DLL should be defined for when 
building applications as well, since they need the 'dllimport' to be 
able to link to opensg-dlls. (unless, opensg is built to static libs and 
you link your application to them, creating one exe and no dlls, then it 
looks ok, but I suspect you are linking to the stub-libs for the dlls as 
usual?)

Cheers,
/Marcus

Allen Bierbaum wrote:
> All the libraries compile now but I get problems compiling 
> applications.  I have traced it down to the usage of defines like   
> OSG_SYSTEM_EXPIMP_TMPL  in OSGSystemDef.h.
>
> Here is the rundown:
>
> The code in OSGSystemDef.h look like:
>
> #if defined(WIN32) && defined(OSG_BUILD_DLL)
> #   ifdef OSG_COMPILESYSTEMLIB
> #       define OSG_SYSTEM_DLLMAPPING  __declspec(dllexport)
> #       define OSG_SYSTEM_EXPIMP_TMPL
> #   else
> #       define OSG_SYSTEM_DLLMAPPING  __declspec(dllimport)
> #       define OSG_SYSTEM_EXPIMP_TMPL   extern
> #   endif
> #else
> #define OSG_SYSTEM_DLLMAPPING
> #endif
>
> As you can see, when building a DLL OSG_SYSTEM_EXPIMP_TMPL is defined so 
> either nothing or extern.
>
> But with compiling an application, it doesn't get defined to anything.
>
> This is a problem for code that uses it.  For example in 
> OSGSceneFileHandler.h there is code like this:
>
> #if defined(WIN32)
> #    if !defined(OSG_COMPILE_SCENEFILEHANDLER)
> OSG_SYSTEM_EXPIMP_TMPL
> template class OSG_SYSTEM_DLLMAPPING SingletonHolder<SceneFileHandlerBase>;
> #    endif
> #endif
>
> (note: the OSG_COMPILE_SCENEFILEHANDLER is defined only in 
> OSGSceneFileHandler.cpp so the normal case is to include this line of 
> code when including the header)
>
> The compile horks on this because OSG_SYSTEM_EXPIMP_TMPL doesn't mean 
> anything to it.  I am guessing that what we want is to have it defined 
> as extern by default when we are on windows.  On a side note, I would 
> also expect that on windows we would want to use dllimport by default as 
> well, but maybe I am missing something.
>
> I would expect the code to look more like:
>
> #if defined(WIN32)                            //&& defined(OSG_BUILD_DLL)
> #   ifdef OSG_COMPILESYSTEMLIB
> #       define OSG_SYSTEM_DLLMAPPING  __declspec(dllexport)
> #       define OSG_SYSTEM_EXPIMP_TMPL
> #   else
> #       define OSG_SYSTEM_DLLMAPPING  __declspec(dllimport)
> #       define OSG_SYSTEM_EXPIMP_TMPL   extern
> #   endif
> #else
> #define OSG_SYSTEM_DLLMAPPING
> #define OSG_SYSTEM_EXPIMP_TMPL
> #endif
>
> But things work for the configure build, so what am I missing?
>
> -Allen
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users
>   


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to