Conflicts between Ogre and third party libs...

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
katskos
Gnoblar
Posts: 3
Joined: Sun Jan 30, 2005 4:13 pm

Conflicts between Ogre and third party libs...

Post by katskos »

I am trying to compile an Ogre project in VS .NET 2003 combined with
Ruby as a script language. I get strange errors during compile. I have
managed to explain those errors and can't find a way out.
Let me give you an examle:

a typical error is this:
ogreroot.h(387): error C2059: syntax error : ')'
the line in question is this: void shutdown(void);

The reason for the above is this:
When i include Ruby.h before any ogre headers i get the above error
because ruby defines a shutdown macro in win32.h. So the compiler
considers shutdown as a macro.

If i include ruby.h after any ogre headers i get other kinds of errors
considering memory management functions.
e.g. Ogre defines calloc as a macro while ruby.h includes malloc.h
and declares calloc as function prototype and i get erros again.

Does anybody know a smart tactic or any advice to solve the above?
There must be a solution for all of this.
I wouldn't want to shutdown Ogre's memory management.

Thanks in advance.
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7

Post by haffax »

katsakos, we have the same problem using ruby as our scripting language. We us an include file, that we include after including "ruby.h".

You can find it here.
This is how we use it:

Code: Select all

#include <OgreNoMemoryMacros.h>
#include <ruby.h>
#include "FixRubyHeaders.h"
#include <OgreMemoryMacros.h>
I don't know if this is smart or elegant but it works. :)
team-pantheon programmer
creators of Rastullahs Lockenpracht
katskos
Gnoblar
Posts: 3
Joined: Sun Jan 30, 2005 4:13 pm

Post by katskos »

Thanks alot. :D This seems elegant to me.