[MOAB-dev] r4703 - MOAB/trunk/src/moab

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Thu Mar 31 15:06:16 CDT 2011


Author: kraftche
Date: 2011-03-31 15:06:16 -0500 (Thu, 31 Mar 2011)
New Revision: 4703

Modified:
   MOAB/trunk/src/moab/Types.hpp
Log:
Fix previous checkin of string arrays for enums: they are not available to C code

If Types.hpp is included in C (not C++) code the declarations appear in the
global namespace rather than the 'moab' one.  However, the actual array
implementations in Types.cpp are always in the 'moab' namespace.  So C code
trying to use them will encounter link errors.  Wrap the array declarations
in Types.hpp in "#ifdef __cpluscplus" so it is obvious at compile time that 
they will not be available to C code.



Modified: MOAB/trunk/src/moab/Types.hpp
===================================================================
--- MOAB/trunk/src/moab/Types.hpp	2011-03-31 19:58:10 UTC (rev 4702)
+++ MOAB/trunk/src/moab/Types.hpp	2011-03-31 20:06:16 UTC (rev 4703)
@@ -49,7 +49,9 @@
                    MB_STRUCTURED_MESH,
                    MB_FAILURE};
 
+#ifdef __cplusplus
 extern const char* const ErrorCodeStr[];
+#endif
 
 /** Misc. integer constants, declared in enum for portability */
 enum Constants {
@@ -83,7 +85,9 @@
   MB_MAX_DATA_TYPE = MB_TYPE_HANDLE
 };
 
+#ifdef __cplusplus
 extern const char* const DataTypeStr[];
+#endif
 
 /** Used to reference tags; since they're so different from entities, we
  *  use void** instead of a uint to prevent them from being confused as 
@@ -108,7 +112,9 @@
   SENSE_FORWARD      =  1  /**< forward  */
 };
 
+#ifdef __cplusplus
 extern const char* const* const SenseTypeStr;
+#endif
 
 #ifdef __cplusplus
 } /* namespace moab */



















More information about the moab-dev mailing list