EXPORT_CODE long CONVENTION AbstractState_factory(const char* backend, const char* fluids, long *errcode, char *message_buffer, const long buffer_length) { *errcode = 0; try{ shared_ptr<CoolProp::AbstractState> AS(CoolProp::AbstractState::factory(backend, fluids)); return handle_manager.add(AS); } catch(CoolProp::HandleError &e){ std::string errmsg = std::string("HandleError: ") + e.what(); if (errmsg.size() < static_cast<std::size_t>(buffer_length)){ *errcode = 1; strcpy(message_buffer, errmsg.c_str()); } else{ *errcode = 2; } } catch(CoolProp::CoolPropBaseError &e){ std::string errmsg = std::string("Error: ") + e.what(); if (errmsg.size() < static_cast<std::size_t>(buffer_length)){ *errcode = 1; strcpy(message_buffer, errmsg.c_str()); } else{ *errcode = 2; } } catch(...){ *errcode = 3; } return -1; }
EXPORT_CODE long CONVENTION AbstractState_factory(const char* backend, const char* fluids, long *errcode, char *message_buffer, const long buffer_length) { *errcode = 0; try{ shared_ptr<CoolProp::AbstractState> AS(CoolProp::AbstractState::factory(backend, fluids)); return handle_manager.add(AS); } catch (...) { HandleException(errcode, message_buffer, buffer_length); } return -1; }