Huh. I hadn't even considered something like that, but that's really clever. My first thought was actually a namespace, but that would have been far more editing than I really wanted to do, so this solves that problem quite nicely and doesn't have the awkward naming like in my other patch. I've attached another one with this method instead along with the missing libraries that I mentioned before, so hopefully it can be reviewed by somebody.<div>
<br><div class="gmail_quote">On Sun, Jul 11, 2010 at 06:36, Andrew Church <span dir="ltr"><<a href="mailto:achurch%2Baquaria@achurch.org">achurch+aquaria@achurch.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">>I did some checking and it turns out that InputMode, INPUT_MOUSE, and<br>
>INPUT_KEYBOARD in there are all already defined by Visual Studio. So is<br>
>hash() in Base.h/cpp, as I later found. After renaming those (along with<br>
>INPUT_JOYSTICK, for consistency), I was able to compile fine, so I wanted to<br>
>submit a patch for this.<br>
<br>
</div>Another possibility is to just redefine/undefine those specific macros<br>
when building in Visual Studio -- that would be my suggestion, as it<br>
avoids the need to rewrite identifiers in dozens of different files.<br>
This could probably be done in BBGE/Base.h, with something like:<br>
<br>
// Rename anything that's a type or function (not a #define).<br>
#ifdef _MSC_VER<br>
#define InputMode _MSC_InputMode<br>
#define hash _MSC_hash<br>
#endif<br>
<br>
// System #includes go here.<br>
<br>
// Undefine the renaming macros as well as other macros defined by the<br>
// system headers that we don't want.<br>
#ifdef _MSC_VER<br>
#undef InputMode<br>
#undef INPUT_MOUSE<br>
#undef INPUT_KEYBOARD<br>
#undef hash<br>
#endif<br>
<br>
This is the approach I've used in my own cross-platform work, though<br>
usually just to work around identifier shadowing warnings. (I'd<br>
certainly like to have a few words with whoever on the POSIX committee<br>
thought it would be a good idea to have global library functions named<br>
y0() and y1()...)<br>
<font color="#888888"><br>
--Andrew Church<br>
<a href="mailto:achurch@achurch.org">achurch@achurch.org</a><br>
<a href="http://achurch.org/" target="_blank">http://achurch.org/</a><br>
_______________________________________________<br>
aquaria mailing list<br>
<a href="mailto:aquaria@icculus.org">aquaria@icculus.org</a><br>
<a href="http://icculus.org/mailman/listinfo/aquaria" target="_blank">http://icculus.org/mailman/listinfo/aquaria</a><br>
</font></blockquote></div><br></div>