Skip to content

Commit

Permalink
Main: add debug build guard on Ogre::Root
Browse files Browse the repository at this point in the history
triggers LNK2019 on Ogre::DebugBuild::Root
  • Loading branch information
paroj committed Oct 24, 2024
1 parent 24b82de commit da1ff43
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions OgreMain/include/OgrePrerequisites.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ THE SOFTWARE
#include <string>
#include <memory>

// extra namespace to trigger LNK2019 on binary incompatible builds
// instead of crashing at runtime
#if defined(_MSC_VER) && defined(_DEBUG)
#define OGRE_DEBUG_NS_BEGIN namespace DEBUG_BUILD_REQUIRED {
#define OGRE_DEBUG_NS_END }
namespace Ogre { namespace DEBUG_BUILD_REQUIRED { } using namespace DEBUG_BUILD_REQUIRED; }
#else
#define OGRE_DEBUG_NS_BEGIN
#define OGRE_DEBUG_NS_END
#endif

namespace Ogre {
#define OGRE_TOKEN_PASTE_INNER(x, y) x ## y
#define OGRE_TOKEN_PASTE(x, y) OGRE_TOKEN_PASTE_INNER(x, y)
Expand Down Expand Up @@ -211,7 +222,9 @@ namespace Ogre {
class ResourceGroupManager;
class ResourceManager;
class RibbonTrail;
OGRE_DEBUG_NS_BEGIN
class Root;
OGRE_DEBUG_NS_END
class SceneManager;
class SceneNode;
class SceneQuery;
Expand Down
3 changes: 3 additions & 0 deletions OgreMain/include/OgreRoot.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ namespace Ogre
/// Scene manager instances, indexed by instance name
typedef std::map<String, SceneManager*> SceneManagerInstanceMap;

OGRE_DEBUG_NS_BEGIN

/** The root class of the Ogre system.
The Ogre::Root class represents a starting point for the client
Expand Down Expand Up @@ -925,6 +927,7 @@ namespace Ogre
*/
Real getDefaultMinPixelSize() { return mDefaultMinPixelSize; }
};
OGRE_DEBUG_NS_END
/** @} */
/** @} */
} // Namespace Ogre
Expand Down

0 comments on commit da1ff43

Please sign in to comment.