[geeks] porting OSX C++ to linux
Joshua D Boyd
jdboyd at cs.millersville.edu
Tue Jul 16 23:32:07 CDT 2002
I have a program that compiles on OSX (allegedly), and win32, but two
of it's files won't compile under linux (with GCC 2.95.4).
They both complain about a missing function. Apparently, on win32,
visuall c++ has it built in, but gcc on osx requires these lines:
#if project_builder
// If your system doesn't have a rotate function for 32 bits integers,
// then define it thus:
static unsigned long _lrotl (unsigned long x, int r) {
return (x << r) | (x >> (sizeof(x)*8-r));}
#endif
What would be the proper way to #if that is that it is true for both
OSX and linux? I must admit, my experience with cross platform
projects is pretty minimal. When faced with it, I seperate all my N
platforms into N+1 directories (where the N+1th directory is for
platform neutral stuff), then try to place as much of the logic as
possible in the N+1th directory, rather than everything sharing one
codebase.
--
Joshua D. Boyd
More information about the geeks
mailing list