64 bit build

DonnellyHall

30-03-2012 17:46:57

I was building Caelum 0.6.1 in 64bit with Visual Studio C++ 2008 SP1

In Astronomy.cpp there is a #if conditional around Astronomy::enterHighPrecissionFloatingPointMode and Astronomy::restoreFloatingPointMode as follows

#if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && (OGRE_COMPILER == OGRE_COMPILER_MSVC)

The conditional enables the code:


int oldMode = ::_controlfp (0, 0);
::_controlfp (_PC_64, _MCW_PC);
return oldMode;


But - this does not cater for 64 bit.

According to this page on the Microsoft website: http://bit.ly/GY2WT9

On the x64 architecture, changing the floating point precision is not supported. If the precision control mask is used on that platform, an assertion and the invalid parameter handler is invoked.

... and indeed, building this for 64 bit and running with my application causes a low level runtime crash.

In order to fix this the conditional needs to become:

#if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && (OGRE_COMPILER == OGRE_COMPILER_MSVC) && !(OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_64)

...or at least - that works for me!

jessome

13-07-2012 12:46:33

I just applied a similar fix myself and was about to post about it, but you beat me too it. This should probably make its way into the repository at some point.