[Nexus-developers] Macros in napi.h

Ray Osborn rosborn at anl.gov
Mon Dec 6 16:57:04 GMT 2004


At the moment, the latest installation kit downloaded off the CVS server
works flawlessly until trying to compile NXdir.  The problem is:

In file included from nxdir.h:38,
                 from main.cpp:25:
../../../include/napi.h:259:5: #error Cannot compile - unknown operating

 which is generated during the name mangling sequence.  It fails because for
Mac OS X, the line

 if defined(__unix) || defined(__unix__)

 doesn't work unless -D__unix has been added to the compilation line.  I was
googling to find out what Mac OS X does routinely set instead when I came
across the following provocative statement in a mailing list:
----
Any program which relies on "unix" or "__unix__" being defined is really
broken, since there are quite a number of Unix systems which do NOT define
those macros.
----

Since Mac OS X is evidently one of these unix systems, he seems to have a
point.  Is there a better way to achieve the same effect?  The name mangling
in napi.h is particularly ugly code.  Can't it be handled by autoconf now?

Ray
P.S. I think __APPLE__ is defined as a macro in Mac OS X.  I added it to the
above line in napi.h, and it seemed to work.  Any reasons why I shouldn't
add it to the CVS copy?
-- 
Dr Ray Osborn                Tel: +1 (630) 252-9011
Materials Science Division   Fax: +1 (630) 252-7777
Argonne National Laboratory  E-mail: ROsborn at anl.gov
Argonne, IL 60439-4845





More information about the NeXus-developers mailing list