diff --git a/CMakeLists.txt b/CMakeLists.txt index 75c0cb4a..156b4c22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -342,6 +342,8 @@ if (COOLPROP_OCTAVE_MODULE) list(APPEND OCTAVE_WRAP_INCLUDE_DIRS ${ITR}) endforeach() include_directories(${OCTAVE_INCLUDE_DIRS}) + + add_definitions(-DNO_ERROR_CATCHING) #disable internal error catching and allow swig to do the error catching itself set(I_FILE "${CMAKE_SOURCE_DIR}/src/CoolProp.i") @@ -411,6 +413,8 @@ if (COOLPROP_CSHARP_MODULE) #SET_SOURCE_FILES_PROPERTIES(${I_FILE} PROPERTIES SWIG_FLAGS "-dllimport CoolProp") endif() SWIG_ADD_MODULE(CoolProp csharp ${I_FILE} ${APP_SOURCES}) + + add_definitions(-DNO_ERROR_CATCHING) #disable internal error catching and allow swig to do the error catching itself if (WIN32) set_target_properties(CoolProp PROPERTIES PREFIX "") @@ -475,6 +479,8 @@ if (COOLPROP_JAVA_MODULE) string(REPLACE " " ";" SWIG_OPTIONS "${SWIG_OPTIONS}") SET_SOURCE_FILES_PROPERTIES(${I_FILE} PROPERTIES SWIG_FLAGS "${SWIG_OPTIONS}") SET_SOURCE_FILES_PROPERTIES(${I_FILE} PROPERTIES CPLUSPLUS ON) + + add_definitions(-DNO_ERROR_CATCHING) #disable internal error catching and allow swig to do the error catching itself SET(SWIG_MODULE_CoolProp_EXTRA_DEPS ${CMAKE_SOURCE_DIR}/include/DataStructures.h @@ -532,6 +538,8 @@ if (COOLPROP_PHP_MODULE) message(STATUS "php includes=${PHP_INCLUDES}") include_directories(${PHP_INCLUDES}) + + add_definitions(-DNO_ERROR_CATCHING) #disable internal error catching and allow swig to do the error catching itself set(I_FILE "${CMAKE_SOURCE_DIR}/src/CoolProp.i") @@ -590,6 +598,8 @@ if (COOLPROP_SCILAB_SWIG_MODULE) set(SCILAB_INCLUDE_PATH "$ENV{SCILAB_ROOT}/include") set(I_FILE "${CMAKE_SOURCE_DIR}/src/CoolProp.i") + + add_definitions(-DNO_ERROR_CATCHING) #disable internal error catching and allow swig to do the error catching itself include_directories(${SCILAB_INCLUDE_PATH}) include_directories(${SCILAB_INCLUDE_PATH}/scilab) @@ -624,6 +634,8 @@ if (COOLPROP_MATLAB_SWIG_MODULE) MESSAGE("MATLAB not found...nothing will be built.") ENDIF(MATLAB_FOUND) + add_definitions(-DNO_ERROR_CATCHING) #disable internal error catching and allow swig to do the error catching itself + set(I_FILE "${CMAKE_SOURCE_DIR}/src/CoolProp.i") list (APPEND APP_SOURCES ${CMAKE_SOURCE_DIR}/wrappers/MATLAB/Matlabdef.def) # To export mexFunction diff --git a/src/CoolProp.cpp b/src/CoolProp.cpp index e9fbc282..68b2da1a 100644 --- a/src/CoolProp.cpp +++ b/src/CoolProp.cpp @@ -307,11 +307,9 @@ double Props1SI(const std::string &FluidName, const std::string &Output) double PropsSI(const std::string &Output, const std::string &Name1, double Prop1, const std::string &Name2, double Prop2, const std::string &Ref) { std::string backend, fluid; - #if !defined(PROPSSI_NO_ERROR_CATCH) + #if !defined(NO_ERROR_CATCHING) // In this function the error catching happens; try{ - #else - std::cout << "macro is on; error checking disabled in PropsSI" << std::endl; #endif // BEGIN OF TRY // Here is the real code that is inside the try block @@ -320,7 +318,7 @@ double PropsSI(const std::string &Output, const std::string &Name1, double Prop1 if (get_debug_level() > 1){ std::cout << format("_PropsSI will return %g",val) << std::endl; } return val; // END OF TRY - #if !defined(PROPSSI_NO_ERROR_CATCH) + #if !defined(NO_ERROR_CATCHING) } catch(const std::exception& e){ set_error_string(e.what() + format(" : PropsSI(\"%s\",\"%s\",%0.10g,\"%s\",%0.10g,\"%s\")",Output.c_str(),Name1.c_str(), Prop1, Name2.c_str(), Prop2, Ref.c_str()));