Skip to content

Commit 1410fac

Browse files
committed
Main: add debug build guard on Ogre::Root
triggers LNK2019 on Ogre::DebugBuild::Root
1 parent 955c63b commit 1410fac

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

OgreMain/include/OgrePrerequisites.h

+13
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ THE SOFTWARE
3232
#include <string>
3333
#include <memory>
3434

35+
// extra namespace to trigger LNK2019 on binary incompatible builds
36+
// instead of crashing at runtime
37+
#if defined(_MSC_VER) && defined(_DEBUG)
38+
#define OGRE_DEBUG_NS_BEGIN namespace DEBUG_BUILD_REQUIRED {
39+
#define OGRE_DEBUG_NS_END }
40+
namespace Ogre { namespace DEBUG_BUILD_REQUIRED { } using namespace DEBUG_BUILD_REQUIRED; }
41+
#else
42+
#define OGRE_DEBUG_NS_BEGIN
43+
#define OGRE_DEBUG_NS_END
44+
#endif
45+
3546
namespace Ogre {
3647
#define OGRE_TOKEN_PASTE_INNER(x, y) x ## y
3748
#define OGRE_TOKEN_PASTE(x, y) OGRE_TOKEN_PASTE_INNER(x, y)
@@ -211,7 +222,9 @@ namespace Ogre {
211222
class ResourceGroupManager;
212223
class ResourceManager;
213224
class RibbonTrail;
225+
OGRE_DEBUG_NS_BEGIN
214226
class Root;
227+
OGRE_DEBUG_NS_END
215228
class SceneManager;
216229
class SceneNode;
217230
class SceneQuery;

OgreMain/include/OgreRoot.h

+3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ namespace Ogre
5555
/// Scene manager instances, indexed by instance name
5656
typedef std::map<String, SceneManager*> SceneManagerInstanceMap;
5757

58+
OGRE_DEBUG_NS_BEGIN
59+
5860
/** The root class of the Ogre system.
5961
6062
The Ogre::Root class represents a starting point for the client
@@ -925,6 +927,7 @@ namespace Ogre
925927
*/
926928
Real getDefaultMinPixelSize() { return mDefaultMinPixelSize; }
927929
};
930+
OGRE_DEBUG_NS_END
928931
/** @} */
929932
/** @} */
930933
} // Namespace Ogre

0 commit comments

Comments
 (0)