Re: [osg-users] Debug versus release libraries.

2010-01-12 Thread Jean-Sébastien Guay

Hello Nico,


Is this setup possible at all? Is there something special I have to setup?


Please read the archives, this has been discussed a lot in the past. On 
Visual Studio, you cannot mix debug and release (when the C++ runtime is 
concerned). All C++ libraries and the executable itself need to use the 
same runtime.


This is not true for C libraries, you can link debug or release C 
libraries into a debug or release C/C++ application without problems. 
That's what we often do for dependencies, even within OSG itself (the 
3rdparty packages include debug and release libs for most, but not all, 
dependent C libraries, but you could link to the release version for all 
builds if you wanted). But for C++ libraries they have to match the 
application.


There are a few reasons for this, the most apparent is that iterators 
have a different size in memory in the debug and release C++ runtimes. 
So if you don't match debug to debug and release to release, it will be 
moving pointers by the wrong amount of bytes when incrementing 
iterators, which will result in crashes (or at the very least garbage).


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Debug versus release libraries.

2010-01-12 Thread Nico Kruithof
Hi Jean-Sebastien,

Thanks for the clear explanation and sorry for not searching the archives. I
know I should. My main experience is from the linux world where I used to do
it quite often.

-- Nico

On Tue, Jan 12, 2010 at 3:00 PM, Jean-Sébastien Guay 
jean-sebastien.g...@cm-labs.com wrote:

 Hello Nico,


  Is this setup possible at all? Is there something special I have to setup?


 Please read the archives, this has been discussed a lot in the past. On
 Visual Studio, you cannot mix debug and release (when the C++ runtime is
 concerned). All C++ libraries and the executable itself need to use the same
 runtime.

 This is not true for C libraries, you can link debug or release C libraries
 into a debug or release C/C++ application without problems. That's what we
 often do for dependencies, even within OSG itself (the 3rdparty packages
 include debug and release libs for most, but not all, dependent C libraries,
 but you could link to the release version for all builds if you wanted). But
 for C++ libraries they have to match the application.

 There are a few reasons for this, the most apparent is that iterators have
 a different size in memory in the debug and release C++ runtimes. So if you
 don't match debug to debug and release to release, it will be moving
 pointers by the wrong amount of bytes when incrementing iterators, which
 will result in crashes (or at the very least garbage).


 Hope this helps,

 J-S
 --
 __
 Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org