├── .gitignore ├── .travis.yml ├── CMakeLists.txt ├── LICENSE ├── README.md ├── REFPROP_lib.h ├── REFPROP_underscore_lowercase_renaming.h ├── generate_header.py ├── generate_mangling_header.py ├── main.cpp ├── other.cpp ├── scrape_PASS_FTN.py └── testRP.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | 19 | # Compiled Python files 20 | *.pyc 21 | 22 | # Compiled Static libraries 23 | *.lai 24 | *.la 25 | *.a 26 | *.lib 27 | 28 | # Executables 29 | *.exe 30 | *.out 31 | *.app 32 | /build 33 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | 2 | notifications: 3 | email: 4 | on_success: never 5 | on_failure: change 6 | 7 | language: 8 | - cpp 9 | 10 | matrix: 11 | include: 12 | - os: linux 13 | dist: trusty 14 | compiler: gcc 15 | - os: linux 16 | dist: trusty 17 | compiler: clang 18 | - os: linux 19 | dist: trusty 20 | addons: 21 | coverity_scan: 22 | project: 23 | name: "CoolProp/REFPROP-headers" 24 | description: "Build submitted via Travis CI" 25 | notification_email: jowr@ipu.dk 26 | build_command_prepend: "cmake ." 27 | build_command: "cmake --build . --target Main" 28 | branch_pattern: coverity_scan 29 | 30 | # Build all branches 31 | branches: 32 | only: 33 | - /.*/ 34 | 35 | env: 36 | global: 37 | - secure: "NPlkNTLzYM1bZgI09fsoShW36AmEQq7VJHARIxQkv37rvhEMcEzkWSumEvoZrVlk5v0oGSFofllAAUI9cIdDjBd6nQ8wyO+/PMFliiU5CtwAjA7WMwRHloH/G8dxbHbLFl/ahHrkIyyGuaJDMfsmd6VMBSmIVpbHUHeobbr6oUU=" 38 | 39 | before_script: 40 | - mkdir -p build 41 | - pushd build 42 | - cmake .. 43 | - popd 44 | 45 | script: 46 | - cmake --build build --target Main 47 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 2.8) 2 | project (REFPROP) 3 | add_executable(Main main.cpp other.cpp) 4 | if(UNIX) 5 | target_link_libraries(Main dl) 6 | endif() -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | REFPROP-headers 2 | =============== 3 | 4 | This is a tiny repository that contains header files for the REFPROP fluid property library. The header files should work with both C++ and C. 5 | 6 | Options 7 | ------- 8 | 9 | A) Generate function prototypes (only) - for static linkage: 10 | 11 | #define REFPROP_PROTOTYPES 12 | #include "REFPROP_lib.h" 13 | #undef REFPROP_PROTOTYPES 14 | 15 | B) (In one file only!!!) Generate the interface code for runtime linkage of REFPROP (see main.cpp): 16 | 17 | #define REFPROP_IMPLEMENTATION 18 | #include "REFPROP_lib.h" 19 | #undef REFPROP_IMPLEMENTATION 20 | 21 | If you want to call these functions elsewhere, best to define a prototype in your own code: 22 | 23 | extern bool load_REFPROP(std::string &err, const std::string &shared_library_path = "", const std::string &shared_library_name = ""); 24 | 25 | C) (default) Add definitions of the function pointers (for all the other files that call REFPROP when REFPROP is runtime linked): 26 | 27 | #include "REFPROP_lib.h" 28 | 29 | Usage 30 | ----- 31 | 32 | Please see the ``CMakeLists.txt`` cmake build system which includes examples of two files that both call into REFPROP. Distribution of the ``REFPROP_lib.h`` file with your C++ code should be sufficient. There are two static variables that can be used for debugging purposes, ``std::string RPVersion_loaded`` and ``RPPath_loaded``. 33 | 34 | In order to build the cmake examples, do something like (in the root of code, next to ``CMakeLists.txt``): 35 | 36 | mkdir build 37 | cd build 38 | cmake .. 39 | cmake --build . 40 | 41 | which uses all default flags. For more information, read the cmake docs. 42 | 43 | Testing 44 | ------- 45 | 46 | The steps described above are also carried out by our test server running on Travis CI that periodically submits builds to Coverity. 47 | 48 | - Travis CI build status: [![Travis Status](https://travis-ci.org/CoolProp/REFPROP-headers.svg?branch=master)](https://travis-ci.org/CoolProp/REFPROP-headers) 49 | - Coverity Scan status: [![Coverity Status](https://scan.coverity.com/projects/12519/badge.svg)](https://scan.coverity.com/projects/coolprop-refprop-headers) 50 | 51 | 52 | Notes on integers 53 | ----------------- 54 | 55 | The handling of integer types in mixed language compilation (C/FORTRAN) is a bit complicated. Thanks to the work of Chris Muzny at NIST, it has been determined that the proper approach to dealing with integers between FORTRAN and C/C++ is to use the ``int`` type always. 56 | 57 | On all platforms, the ``INTEGER`` type in FORTRAN is by default 4 bytes. You can write a small program that demonstrates this if you are unsure: 58 | 59 | ``` fortran 60 | PROGRAM SIZE_TEST 61 | INTEGER I1 62 | print *,"Size of INTEGER: ",sizeof(I1) 63 | ``` 64 | 65 | Similarly, you can demonstrate that the int type is 4 bytes on all platforms and bitnesses (32-bit/64-bit): 66 | 67 | ``` c++ 68 | #include 69 | using namespace std; 70 | int main() 71 | { 72 | cout << "Size of int: " << sizeof(int) << " bytes" << endl; 73 | return 0; 74 | } 75 | ``` 76 | Therefore, you can conclude that the "integer" type that will satisfy FORTRAN and C is the ``int`` type. -------------------------------------------------------------------------------- /REFPROP_lib.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef REFPROP_LIB_H 3 | #define REFPROP_LIB_H 4 | 5 | // The idea here is to have a common header for Windows 6 | // and Linux systems. The Windows branch should cover the 7 | // functions provided by the .dll and the Linux part covers 8 | // the compiled .so file. Name changes caused by gfortran 9 | // are respected and should be accounted for. 10 | 11 | // Get the platform identifiers, some overlap with "PlatformDetermination.h" from CoolProp's main repo 12 | // See also http://stackoverflow.com/questions/5919996/how-to-detect-reliably-mac-os-x-ios-linux-windows-in-c-preprocessor 13 | #if defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(__WIN64__) 14 | # define __RPISWINDOWS__ 15 | #elif defined(__APPLE__) 16 | # define __RPISAPPLE__ 17 | #elif defined(__linux) || defined(__unix) || defined(__posix) 18 | # define __RPISLINUX__ 19 | #elif defined(__powerpc__) 20 | # define __RPISPOWERPC__ 21 | #else 22 | # pragma error 23 | #endif 24 | 25 | // Define compiler specific calling conventions 26 | // for the shared library. 27 | #if defined(__RPISWINDOWS__) 28 | # define RPCALLCONV __stdcall 29 | #else 30 | # define RPCALLCONV 31 | #endif 32 | 33 | #if defined(__cplusplus) 34 | // Function prototypes that are implemented below when REFPROP_IMPLEMENTATION macro is defined 35 | // before this header is included. REFPROP_IMPLEMENTATION shall be implemented in ONLY ONE 36 | // compilation unit 37 | #include 38 | bool load_REFPROP(std::string &err, const std::string &shared_library_path = "", const std::string &shared_library_name = ""); 39 | bool unload_REFPROP(std::string &err); 40 | std::size_t REFPROP_address(); 41 | #endif 42 | 43 | // ****************************************** 44 | // ****************************************** 45 | // Headers (platform specific and otherwise) 46 | // ****************************************** 47 | // ****************************************** 48 | 49 | #ifdef REFPROP_IMPLEMENTATION 50 | 51 | #ifndef __cplusplus 52 | #error REFPROP_IMPLEMENTATION can only be used in C++ 53 | #endif 54 | 55 | #if defined(__RPISPOWERPC__) 56 | #include 57 | #elif defined(__RPISLINUX__) || defined(__RPISAPPLE__) 58 | #include 59 | #include 60 | #elif defined(__RPISWINDOWS__) 61 | 62 | #if defined(_MSC_VER) 63 | #ifndef _CRT_SECURE_NO_WARNINGS 64 | #define _CRT_SECURE_NO_WARNINGS 65 | #endif 66 | #endif 67 | 68 | #ifndef NOMINMAX 69 | #define NOMINMAX 70 | #include 71 | #undef NOMINMAX 72 | #else 73 | #include 74 | #endif 75 | 76 | #if defined(_MSC_VER) 77 | #undef _CRT_SECURE_NO_WARNINGS 78 | #endif 79 | 80 | 81 | #else 82 | #pragma error 83 | #endif 84 | 85 | #include 86 | #include 87 | #include 88 | 89 | #endif 90 | 91 | /* See http://stackoverflow.com/a/148610 92 | * See http://stackoverflow.com/questions/147267/easy-way-to-use-variables-of-enum-types-as-string-in-c#202511 93 | * This will be used to generate function names, pointers, etc. below 94 | */ 95 | #define LIST_OF_REFPROP_FUNCTION_NAMES \ 96 | X(ABFL1dll) \ 97 | X(ABFL2dll) \ 98 | X(ABFLSHdll) \ 99 | X(ABFLASHdll) \ 100 | X(AGdll) \ 101 | X(ALLPROPS0dll) \ 102 | X(ALLPROPS1dll) \ 103 | X(ALLPROPS20dll) \ 104 | X(ALLPROPSdll) \ 105 | X(B12dll) \ 106 | X(BLCRVdll) \ 107 | X(CCRITdll) \ 108 | X(CHEMPOTdll) \ 109 | X(CP0dll) \ 110 | X(CRITPdll) \ 111 | X(CRTPNTdll) \ 112 | X(CSATKdll) \ 113 | X(CSTARdll) \ 114 | X(CV2PKdll) \ 115 | X(CVCPKdll) \ 116 | X(CVCPdll) \ 117 | X(DBDTdll) \ 118 | X(DBFL1dll) \ 119 | X(DBFL2dll) \ 120 | X(DDDPdll) \ 121 | X(DDDTdll) \ 122 | X(DEFL1dll) \ 123 | X(DEFLSHdll) \ 124 | X(DERVPVTdll) \ 125 | X(DHD1dll) \ 126 | X(DHFL1dll) \ 127 | X(DHFLSHdll) \ 128 | X(DIELECdll) \ 129 | X(DLSATKdll) \ 130 | X(DPDD2dll) \ 131 | X(DPDDdll) \ 132 | X(DPDTdll) \ 133 | X(DPTSATKdll) \ 134 | X(DQFL2dll) \ 135 | X(DSD1dll) \ 136 | X(DSFL1dll) \ 137 | X(DSFLSHdll) \ 138 | X(DVSATKdll) \ 139 | X(ENTHALdll) \ 140 | X(ENTROdll) \ 141 | X(ERRMSGdll) \ 142 | X(ESFLSHdll) \ 143 | X(EXCESSdll) \ 144 | X(FGCTY2dll) \ 145 | X(FGCTYdll) \ 146 | X(FLAGSdll) \ 147 | X(FPVdll) \ 148 | X(FUGCOFdll) \ 149 | X(GERG04dll) \ 150 | X(GERG08dll) \ 151 | X(GETENUMdll) \ 152 | X(GETFIJdll) \ 153 | X(GETKTVdll) \ 154 | X(GETMODdll) \ 155 | X(GETREFDIRdll) \ 156 | X(GIBBSdll) \ 157 | X(HEATFRMdll) \ 158 | X(HEATdll) \ 159 | X(HMXORDERdll) \ 160 | X(HSFL1dll) \ 161 | X(HSFLSHdll) \ 162 | X(IDCRVdll) \ 163 | X(INFOdll) \ 164 | X(JICRVdll) \ 165 | X(JTCRVdll) \ 166 | X(LIMITKdll) \ 167 | X(LIMITSdll) \ 168 | X(LIMITXdll) \ 169 | X(LIQSPNDLdll) \ 170 | X(MASSFLUXdll) \ 171 | X(MAXPdll) \ 172 | X(MAXTdll) \ 173 | X(MELTKdll) \ 174 | X(MELTPdll) \ 175 | X(MELTTdll) \ 176 | X(MLTH2Odll) \ 177 | X(NAMEdll) \ 178 | X(PASSCMNdll) \ 179 | X(PDFL1dll) \ 180 | X(PDFLSHdll) \ 181 | X(PEFL1dll) \ 182 | X(PEFLSHdll) \ 183 | X(PHFL1dll) \ 184 | X(PHFLSHdll) \ 185 | X(PHI0dll) \ 186 | X(PHIDERVdll) \ 187 | X(PHIHMXdll) \ 188 | X(PHIKdll) \ 189 | X(PHIMIXdll) \ 190 | X(PHIXdll) \ 191 | X(PQFLSHdll) \ 192 | X(PREOSdll) \ 193 | X(PRESSdll) \ 194 | X(PSATKdll) \ 195 | X(PSFL1dll) \ 196 | X(PSFLSHdll) \ 197 | X(PUREFLDdll) \ 198 | X(QMASSdll) \ 199 | X(QMOLEdll) \ 200 | X(RDXHMXdll) \ 201 | X(REDXdll) \ 202 | X(REFPROP1dll) \ 203 | X(REFPROP2dll) \ 204 | X(REFPROPdll) \ 205 | X(RESIDUALdll) \ 206 | X(RIEMdll) \ 207 | X(RMIX2dll) \ 208 | X(RPVersion) \ 209 | X(SATDdll) \ 210 | X(SATESTdll) \ 211 | X(SATEdll) \ 212 | X(SATGUESSdll) \ 213 | X(SATGVdll) \ 214 | X(SATHdll) \ 215 | X(SATPESTdll) \ 216 | X(SATPdll) \ 217 | X(SATSPLNdll) \ 218 | X(SATSdll) \ 219 | X(SATTESTdll) \ 220 | X(SATTPdll) \ 221 | X(SATTdll) \ 222 | X(SETAGAdll) \ 223 | X(SETFLUIDSdll) \ 224 | X(SETKTVdll) \ 225 | X(SETMIXTUREdll) \ 226 | X(SETMIXdll) \ 227 | X(SETMODdll) \ 228 | X(SETNCdll) \ 229 | X(SETPATHdll) \ 230 | X(SETREFDIRdll) \ 231 | X(SETREFdll) \ 232 | X(SETUPdll) \ 233 | X(SPLNROOTdll) \ 234 | X(SPLNVALdll) \ 235 | X(STNdll) \ 236 | X(SUBLPdll) \ 237 | X(SUBLTdll) \ 238 | X(SURFTdll) \ 239 | X(SURTENdll) \ 240 | X(TDFLSHdll) \ 241 | X(TEFL1dll) \ 242 | X(TEFLSHdll) \ 243 | X(THERM0dll) \ 244 | X(THERM2dll) \ 245 | X(THERM3dll) \ 246 | X(THERMdll) \ 247 | X(THFL1dll) \ 248 | X(THFLSHdll) \ 249 | X(TPFL2dll) \ 250 | X(TPFLSHdll) \ 251 | X(TPRHOPRdll) \ 252 | X(TPRHOdll) \ 253 | X(TQFLSHdll) \ 254 | X(TRNPRPdll) \ 255 | X(TSATDdll) \ 256 | X(TSATPdll) \ 257 | X(TSFL1dll) \ 258 | X(TSFLSHdll) \ 259 | X(UNSETAGAdll) \ 260 | X(VAPSPNDLdll) \ 261 | X(VIRBAdll) \ 262 | X(VIRBCDdll) \ 263 | X(VIRBCD12dll) \ 264 | X(VIRBdll) \ 265 | X(VIRCAdll) \ 266 | X(VIRCdll) \ 267 | X(VIRTAUdll) \ 268 | X(WMOLIdll) \ 269 | X(WMOLdll) \ 270 | X(XMASSdll) \ 271 | X(XMOLEdll) 272 | 273 | // By default the functions are defined to be static and not visible to other compilation units 274 | // You could for instance set this macro to "" which would make the symbols available 275 | #ifndef REFPROP_FUNCTION_MODIFIER 276 | #define REFPROP_FUNCTION_MODIFIER static 277 | #endif 278 | 279 | // define new macros for function names 280 | // http://stackoverflow.com/questions/195975/how-to-make-a-char-string-from-a-c-macros-value 281 | #define STR_VALUE(arg) #arg 282 | #define FUNCTION_NAME(name) STR_VALUE(name) 283 | #define STRINGIFY(name) STR_VALUE(name) 284 | 285 | // In C++, references are done using double &, and in C, using double * 286 | // C++ can use C-style references or pointers 287 | // C can only use pointers 288 | #if !defined(__cplusplus) || defined(REFPROP_CSTYLE_REFERENCES) 289 | // For C compilation, must do double *, int * since C doesn't understand double &, SIZE_T & 290 | #define DOUBLE_REF double * 291 | #define INT_REF int * 292 | #else 293 | #define DOUBLE_REF double & 294 | #define INT_REF int & 295 | #endif 296 | 297 | // We must determine the size of std::size_t because that is the variable type that should be used to define the string lengths 298 | // See also https://software.intel.com/en-us/articles/passing-character-string-in-intel-64-mixed-fortranc-project 299 | #if !defined(__cplusplus) 300 | #if !defined(SIZE_T_TYPE) 301 | #error The preprocessor macro SIZE_T_TYPE must be defined and give the unsigned integer variable type that is the same size (in bytes) as std::size_t 302 | #endif 303 | #define RP_SIZE_T SIZE_T_TYPE 304 | #else 305 | #include 306 | #define RP_SIZE_T std::size_t 307 | #endif 308 | 309 | // Some string length constants for REFPROP... 310 | const static RP_SIZE_T refpropcharlength = 255; 311 | const static RP_SIZE_T filepathlength = 255; 312 | const static RP_SIZE_T lengthofreference = 3; 313 | const static RP_SIZE_T errormessagelength = 255; 314 | const static RP_SIZE_T ncmax = 20; 315 | const static RP_SIZE_T numparams = 72; 316 | const static RP_SIZE_T maxcoefs = 50; 317 | const static RP_SIZE_T componentstringlength = 10000; // Length of component_string (see PASS_FTN.for from REFPROP) 318 | const static RP_SIZE_T versionstringlength = 1000; 319 | 320 | #ifdef REFPROP_LIB_NAMESPACE 321 | namespace REFPROP_LIB_NAMESPACE { 322 | #endif 323 | 324 | #ifdef __cplusplus 325 | extern "C" { 326 | #endif 327 | 328 | // For C calling conventions, replaced all "double &" with "double *", and "int &" with "int *" 329 | 330 | #define ABFL1dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,INT_REF,char *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T,RP_SIZE_T 331 | #define ABFL2dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,INT_REF,INT_REF,char *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T,RP_SIZE_T 332 | #define ABFLSHdll_ARGS char *,DOUBLE_REF,DOUBLE_REF,double *,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T,RP_SIZE_T 333 | #define ABFLASHdll_ARGS char *,DOUBLE_REF,DOUBLE_REF,double *,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T,RP_SIZE_T 334 | #define AGdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF 335 | #define ALLPROPS0dll_ARGS INT_REF,int *,INT_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,INT_REF,char *,RP_SIZE_T 336 | #define ALLPROPS1dll_ARGS char *,INT_REF,DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T,RP_SIZE_T 337 | #define ALLPROPS20dll_ARGS char *,INT_REF,INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,char *,int *,INT_REF,char *,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T 338 | #define ALLPROPSdll_ARGS char *,INT_REF,INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,char *,int *,INT_REF,char *,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T 339 | #define B12dll_ARGS DOUBLE_REF,double *,DOUBLE_REF 340 | #define BLCRVdll_ARGS DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 341 | #define CCRITdll_ARGS DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 342 | #define CHEMPOTdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,double *,INT_REF,char *,RP_SIZE_T 343 | #define CP0dll_ARGS DOUBLE_REF,double *,DOUBLE_REF 344 | #define CRITPdll_ARGS double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 345 | #define CRTPNTdll_ARGS double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 346 | #define CSATKdll_ARGS INT_REF,DOUBLE_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 347 | #define CSTARdll_ARGS DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 348 | #define CV2PKdll_ARGS INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 349 | #define CVCPKdll_ARGS INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF 350 | #define CVCPdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF 351 | #define DBDTdll_ARGS DOUBLE_REF,double *,DOUBLE_REF 352 | #define DBFL1dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,char *,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T,RP_SIZE_T 353 | #define DBFL2dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,INT_REF,char *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T,RP_SIZE_T 354 | #define DDDPdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF 355 | #define DDDTdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF 356 | #define DEFL1dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 357 | #define DEFLSHdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 358 | #define DERVPVTdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF 359 | #define DHD1dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF 360 | #define DHFL1dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 361 | #define DHFLSHdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 362 | #define DIELECdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF 363 | #define DLSATKdll_ARGS INT_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 364 | #define DPDD2dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF 365 | #define DPDDdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF 366 | #define DPDTdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF 367 | #define DPTSATKdll_ARGS INT_REF,DOUBLE_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 368 | #define DQFL2dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,INT_REF,char *,RP_SIZE_T 369 | #define DSD1dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF 370 | #define DSFL1dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 371 | #define DSFLSHdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 372 | #define DVSATKdll_ARGS INT_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 373 | #define ENTHALdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF 374 | #define ENTROdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF 375 | #define ERRMSGdll_ARGS INT_REF,char *,RP_SIZE_T 376 | #define ESFLSHdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 377 | #define EXCESSdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 378 | #define FGCTY2dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,double *,INT_REF,char *,RP_SIZE_T 379 | #define FGCTYdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,double * 380 | #define FLAGSdll_ARGS char *,INT_REF,INT_REF,INT_REF,char *,RP_SIZE_T,RP_SIZE_T 381 | #define FPVdll_ARGS DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF 382 | #define FUGCOFdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,double *,INT_REF,char *,RP_SIZE_T 383 | #define GERG04dll_ARGS INT_REF,INT_REF,INT_REF,char *,RP_SIZE_T 384 | #define GERG08dll_ARGS INT_REF,INT_REF,INT_REF,char *,RP_SIZE_T 385 | #define GETENUMdll_ARGS INT_REF,char *,INT_REF,INT_REF,char *,RP_SIZE_T,RP_SIZE_T 386 | #define GETFIJdll_ARGS char *,double *,char *,char *,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T 387 | #define GETKTVdll_ARGS INT_REF,INT_REF,char *,double *,char *,char *,char *,char *,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T 388 | #define GETMODdll_ARGS INT_REF,char *,char *,char *,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T 389 | #define GETREFDIRdll_ARGS char *,RP_SIZE_T 390 | #define GIBBSdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF 391 | #define HEATFRMdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 392 | #define HEATdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 393 | #define HMXORDERdll_ARGS INT_REF,INT_REF,char *,char *,INT_REF,INT_REF,char *,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T 394 | #define HSFL1dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 395 | #define HSFLSHdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 396 | #define IDCRVdll_ARGS DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 397 | #define INFOdll_ARGS INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF 398 | #define JICRVdll_ARGS DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 399 | #define JTCRVdll_ARGS DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 400 | #define LIMITKdll_ARGS char *,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T,RP_SIZE_T 401 | #define LIMITSdll_ARGS char *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,RP_SIZE_T 402 | #define LIMITXdll_ARGS char *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T,RP_SIZE_T 403 | #define LIQSPNDLdll_ARGS DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 404 | #define MASSFLUXdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 405 | #define MAXPdll_ARGS double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 406 | #define MAXTdll_ARGS double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 407 | #define MELTKdll_ARGS INT_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 408 | #define MELTPdll_ARGS DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 409 | #define MELTTdll_ARGS DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 410 | #define MLTH2Odll_ARGS DOUBLE_REF,DOUBLE_REF,DOUBLE_REF 411 | #define NAMEdll_ARGS INT_REF,char *,char *,char *,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T 412 | #define PASSCMNdll_ARGS char *,INT_REF,INT_REF,INT_REF,char *,INT_REF,DOUBLE_REF,double *,INT_REF,char *,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T 413 | #define PDFL1dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 414 | #define PDFLSHdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 415 | #define PEFL1dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,INT_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 416 | #define PEFLSHdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 417 | #define PHFL1dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,INT_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 418 | #define PHFLSHdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 419 | #define PHI0dll_ARGS INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF 420 | #define PHIDERVdll_ARGS INT_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,double *,INT_REF,char *,RP_SIZE_T 421 | #define PHIHMXdll_ARGS INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF 422 | #define PHIKdll_ARGS INT_REF,INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF 423 | #define PHIMIXdll_ARGS INT_REF,INT_REF,INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF 424 | #define PHIXdll_ARGS INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF 425 | #define PQFLSHdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 426 | #define PREOSdll_ARGS INT_REF 427 | #define PRESSdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF 428 | #define PSATKdll_ARGS INT_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 429 | #define PSFL1dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,INT_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 430 | #define PSFLSHdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 431 | #define PUREFLDdll_ARGS INT_REF 432 | #define QMASSdll_ARGS DOUBLE_REF,double *,double *,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 433 | #define QMOLEdll_ARGS DOUBLE_REF,double *,double *,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 434 | #define RDXHMXdll_ARGS INT_REF,INT_REF,INT_REF,double *,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 435 | #define REDXdll_ARGS double *,DOUBLE_REF,DOUBLE_REF 436 | #define REFPROP1dll_ARGS char *,char *,INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T 437 | #define REFPROP2dll_ARGS char *,char *,char *,INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T 438 | #define REFPROPdll_ARGS char *,char *,char *,INT_REF,INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,char *,INT_REF,double *,double *,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T 439 | #define RESIDUALdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF 440 | #define RIEMdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF 441 | #define RMIX2dll_ARGS double *,DOUBLE_REF 442 | #define RPVersion_ARGS char *,RP_SIZE_T 443 | #define SATDdll_ARGS DOUBLE_REF,double *,INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,INT_REF,char *,RP_SIZE_T 444 | #define SATESTdll_ARGS INT_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,double *,INT_REF,char *,RP_SIZE_T 445 | #define SATEdll_ARGS DOUBLE_REF,double *,INT_REF,INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 446 | #define SATGUESSdll_ARGS INT_REF,INT_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,INT_REF,char *,RP_SIZE_T 447 | #define SATGVdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,INT_REF,INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,INT_REF,char *,RP_SIZE_T 448 | #define SATHdll_ARGS DOUBLE_REF,double *,INT_REF,INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 449 | #define SATPESTdll_ARGS DOUBLE_REF,double *,INT_REF,DOUBLE_REF,double *,INT_REF,char *,RP_SIZE_T 450 | #define SATPdll_ARGS DOUBLE_REF,double *,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,INT_REF,char *,RP_SIZE_T 451 | #define SATSPLNdll_ARGS double *,INT_REF,char *,RP_SIZE_T 452 | #define SATSdll_ARGS DOUBLE_REF,double *,INT_REF,INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 453 | #define SATTESTdll_ARGS DOUBLE_REF,double *,INT_REF,DOUBLE_REF,double *,INT_REF,char *,RP_SIZE_T 454 | #define SATTPdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 455 | #define SATTdll_ARGS DOUBLE_REF,double *,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,INT_REF,char *,RP_SIZE_T 456 | #define SETAGAdll_ARGS INT_REF,char *,RP_SIZE_T 457 | #define SETFLUIDSdll_ARGS char *,INT_REF,RP_SIZE_T 458 | #define SETKTVdll_ARGS INT_REF,INT_REF,char *,double *,char *,INT_REF,char *,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T 459 | #define SETMIXTUREdll_ARGS char *,double *,INT_REF,RP_SIZE_T 460 | #define SETMIXdll_ARGS char *,char *,char *,INT_REF,char *,double *,INT_REF,char *,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T 461 | #define SETMODdll_ARGS INT_REF,char *,char *,char *,INT_REF,char *,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T 462 | #define SETNCdll_ARGS INT_REF 463 | #define SETPATHdll_ARGS char *,RP_SIZE_T 464 | #define SETREFDIRdll_ARGS char *,RP_SIZE_T 465 | #define SETREFdll_ARGS char *,INT_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T,RP_SIZE_T 466 | #define SETUPdll_ARGS INT_REF,char *,char *,char *,INT_REF,char *,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T,RP_SIZE_T 467 | #define SPLNROOTdll_ARGS INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 468 | #define SPLNVALdll_ARGS INT_REF,INT_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 469 | #define STNdll_ARGS DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 470 | #define SUBLPdll_ARGS DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 471 | #define SUBLTdll_ARGS DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 472 | #define SURFTdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 473 | #define SURTENdll_ARGS DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 474 | #define TDFLSHdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 475 | #define TEFL1dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 476 | #define TEFLSHdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 477 | #define THERM0dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF 478 | #define THERM2dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF 479 | #define THERM3dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF 480 | #define THERMdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF 481 | #define THFL1dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 482 | #define THFLSHdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 483 | #define TPFL2dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 484 | #define TPFLSHdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 485 | #define TPRHOPRdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF 486 | #define TPRHOdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,INT_REF,INT_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 487 | #define TQFLSHdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 488 | #define TRNPRPdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 489 | #define TSATDdll_ARGS DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 490 | #define TSATPdll_ARGS DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 491 | #define TSFL1dll_ARGS DOUBLE_REF,DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 492 | #define TSFLSHdll_ARGS DOUBLE_REF,DOUBLE_REF,double *,INT_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,double *,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 493 | #define UNSETAGAdll_ARGS 494 | #define VAPSPNDLdll_ARGS DOUBLE_REF,double *,DOUBLE_REF,INT_REF,char *,RP_SIZE_T 495 | #define VIRBAdll_ARGS DOUBLE_REF,double *,DOUBLE_REF 496 | #define VIRBCD12dll_ARGS DOUBLE_REF,double *,INT_REF,double *,double *,double *,double * 497 | #define VIRBCDdll_ARGS DOUBLE_REF,double *,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF,DOUBLE_REF 498 | #define VIRBdll_ARGS DOUBLE_REF,double *,DOUBLE_REF 499 | #define VIRCAdll_ARGS DOUBLE_REF,double *,DOUBLE_REF 500 | #define VIRCdll_ARGS DOUBLE_REF,double *,DOUBLE_REF 501 | #define VIRTAUdll_ARGS DOUBLE_REF,double *,INT_REF,double *,double *,double *,double *,INT_REF,char *,RP_SIZE_T 502 | #define WMOLIdll_ARGS INT_REF,DOUBLE_REF 503 | #define WMOLdll_ARGS double *,DOUBLE_REF 504 | #define XMASSdll_ARGS double *,double *,DOUBLE_REF 505 | #define XMOLEdll_ARGS double *,double *,DOUBLE_REF 506 | 507 | #if !defined(REFPROP_ONLY_MACROS) 508 | 509 | #if !defined(REFPROP_PROTOTYPES) 510 | 511 | // ***MAGIC WARNING**!! X Macros in use 512 | // See http://stackoverflow.com/a/148610 513 | // See http://stackoverflow.com/questions/147267/easy-way-to-use-variables-of-enum-types-as-string-in-c#202511 514 | 515 | // Further information here: 516 | // http://www.gershnik.com/tips/cpp.asp 517 | 518 | // Define type names for each function 519 | // Each will look something like: typedef void (RPCALLCONV ACTVYdll_TYPE)(ACTVYdll_ARGS); 520 | // 521 | // The ## are needed to escape the _ character in the variable names 522 | // 523 | #define X(name) typedef void (RPCALLCONV name ## _TYPE)(name ## _ARGS); 524 | LIST_OF_REFPROP_FUNCTION_NAMES 525 | #undef X 526 | 527 | // Define explicit function pointers for each function 528 | // Each will look something like: typedef RPVersion_TYPE * RPVersion_POINTER; 529 | // 530 | // The ## are needed to escape the _ character in the variable names 531 | // 532 | #define X(name) typedef name ## _TYPE * name ## _POINTER; 533 | LIST_OF_REFPROP_FUNCTION_NAMES 534 | #undef X 535 | 536 | // Define functions as pointers 537 | // Each will look something like: SETPATHdll_POINTER SETPATHdll; 538 | // 539 | #ifdef REFPROP_IMPLEMENTATION 540 | // Here we want to define them to be used in this file only 541 | // since we are adding all the accessor functions 542 | // Defined as static (by default, but see above) to ensure they are only in this file 543 | #define X(name) REFPROP_FUNCTION_MODIFIER name ## _POINTER name; 544 | LIST_OF_REFPROP_FUNCTION_NAMES 545 | #undef X 546 | #else 547 | // Otherwise, for other files adding the header, define the pointers to be extern, 548 | // so they can see the pointers in a read-only fashion 549 | #define X(name) extern name ## _POINTER name; 550 | LIST_OF_REFPROP_FUNCTION_NAMES 551 | #undef X 552 | #endif 553 | #else 554 | // Otherwise this header becomes just a set of prototypes for the functions 555 | // defining the input parameters 556 | // 557 | // The ## are needed to escape the _ character in the macro name in the intermediate expansion 558 | // 559 | #define X(name) extern void name(name ## _ARGS); 560 | LIST_OF_REFPROP_FUNCTION_NAMES 561 | #undef X 562 | #endif 563 | 564 | #endif // (REFPROP_ONLY_MACROS) 565 | 566 | #ifdef __cplusplus 567 | } // extern "C" 568 | #endif // __cplusplus 569 | 570 | //****************************************************************************** 571 | //****************************************************************************** 572 | //********************* REFPROP IMPLEMENTATION ******************************* 573 | //****************************************************************************** 574 | //****************************************************************************** 575 | 576 | // Define this preprocessor flag to also define the function prototypes and connect function pointers 577 | // N.B. Define this macro in only one location 578 | // N.B. This is C++-only, though with some work it could be made C compatible 579 | #ifdef REFPROP_IMPLEMENTATION 580 | 581 | #if defined(__powerpc__) 582 | static void *RefpropdllInstance=NULL; 583 | #elif defined(__RPISLINUX__) || defined(__RPISAPPLE__) 584 | static void *RefpropdllInstance=NULL; 585 | #elif defined(__RPISWINDOWS__) 586 | static HINSTANCE RefpropdllInstance=NULL; 587 | #else 588 | #pragma error 589 | #endif 590 | 591 | // Define the default library names 592 | const static std::string shared_lib_WIN64 = "REFPRP64.dll"; 593 | const static std::string shared_lib_WIN32 = "REFPROP.dll"; 594 | const static std::string shared_lib_LINUX = "librefprop.so"; 595 | const static std::string shared_lib_APPLE = "librefprop.dylib"; 596 | 597 | static std::string RPVersion_loaded = ""; 598 | static std::string RPPath_loaded = ""; 599 | 600 | enum DLLNameManglingStyle{ NO_NAME_MANGLING = 0, LOWERCASE_NAME_MANGLING, LOWERCASE_AND_UNDERSCORE_NAME_MANGLING }; 601 | 602 | const std::string& get_shared_lib() 603 | { 604 | #if defined(__RPISWINDOWS__) 605 | #if defined(_WIN64) || defined(__WIN64__) 606 | return shared_lib_WIN64; 607 | #elif defined(_WIN32) || defined(__WIN32__) 608 | return shared_lib_WIN32; 609 | #else 610 | if (sizeof(void*) == 8) { // Assume 64bit 611 | return shared_lib_WIN64; 612 | } else { 613 | return shared_lib_WIN32; 614 | } 615 | #endif 616 | #elif defined(__RPISLINUX__) 617 | return shared_lib_LINUX; 618 | #elif defined(__RPISAPPLE__) 619 | return shared_lib_APPLE; 620 | #endif 621 | } 622 | 623 | inline std::string RPlower(std::string str) 624 | { 625 | std::transform(str.begin(), str.end(), str.begin(), ::tolower); 626 | return str; 627 | } 628 | 629 | void *getFunctionPointer(const char *name, DLLNameManglingStyle mangling_style = NO_NAME_MANGLING) 630 | { 631 | std::string function_name; 632 | switch(mangling_style) 633 | { 634 | case NO_NAME_MANGLING: 635 | function_name = name; break; 636 | case LOWERCASE_NAME_MANGLING: 637 | function_name = RPlower(name); break; 638 | case LOWERCASE_AND_UNDERSCORE_NAME_MANGLING: 639 | function_name = RPlower(name) + "_"; break; 640 | } 641 | #if defined(__RPISWINDOWS__) 642 | return (void *) GetProcAddress(RefpropdllInstance, function_name.c_str()); 643 | #elif defined(__RPISLINUX__) 644 | return dlsym(RefpropdllInstance, function_name.c_str()); 645 | #elif defined(__RPISAPPLE__) 646 | return dlsym(RefpropdllInstance, function_name.c_str()); 647 | #else 648 | return NULL; 649 | #endif 650 | } 651 | 652 | /** 653 | * @brief Set the function pointers in the DLL/SO 654 | */ 655 | bool setFunctionPointers(std::string &err) 656 | { 657 | if (RefpropdllInstance==NULL) 658 | { 659 | err = "REFPROP is not loaded, make sure you call this function after loading the library using load_REFPROP."; 660 | return false; 661 | } 662 | /* First determine the type of name mangling in use. 663 | * A) RPVersion -> RPVersion 664 | * B) RPVersion -> rpversion 665 | * C) RPVersion -> rpversion_ 666 | */ 667 | DLLNameManglingStyle mangling_style = NO_NAME_MANGLING; // defaults to no mangling 668 | 669 | SETUPdll = (SETUPdll_POINTER) getFunctionPointer("SETUPdll"); // try NO_NAME_MANGLING 670 | if (SETUPdll == NULL) 671 | { 672 | SETUPdll = (SETUPdll_POINTER) getFunctionPointer("setupdll"); // try LOWERCASE_NAME_MANGLING 673 | if (SETUPdll == NULL) 674 | { 675 | SETUPdll = (SETUPdll_POINTER) getFunctionPointer("setupdll_"); // try LOWERCASE_AND_UNDERSCORE_NAME_MANGLING 676 | if (SETUPdll == NULL) 677 | { 678 | err = "Could not load the symbol SETUPdll or any of its mangled forms; REFPROP shared library broken."; 679 | return false; 680 | } else { 681 | mangling_style = LOWERCASE_AND_UNDERSCORE_NAME_MANGLING; 682 | } 683 | } else { 684 | mangling_style = LOWERCASE_NAME_MANGLING; 685 | } 686 | } else { 687 | mangling_style = NO_NAME_MANGLING; 688 | } 689 | 690 | /* Set the pointers, platform independent 691 | * 692 | * Example: RPVersion = (RPVersion_POINTER) getFunctionPointer(STRINGIFY(RPVersion)); 693 | * 694 | * ***MAGIC WARNING**!! X Macros in use 695 | * See http://stackoverflow.com/a/148610 696 | * See http://stackoverflow.com/questions/147267/easy-way-to-use-variables-of-enum-types-as-string-in-c#202511 697 | */ 698 | #define X(name) name = (name ## _POINTER) getFunctionPointer(STRINGIFY(name), mangling_style); 699 | LIST_OF_REFPROP_FUNCTION_NAMES 700 | #undef X 701 | 702 | return true; 703 | } 704 | 705 | // See http://stackoverflow.com/questions/874134/find-if-string-ends-with-another-string-in-c 706 | inline bool RP_ends_with(const std::string & value, const std::string & ending) { 707 | if (value.empty()) return false; 708 | if (ending.empty()) return false; 709 | if (ending.size() > value.size()) return false; 710 | return std::equal(ending.rbegin(), ending.rend(), value.rbegin()); 711 | } 712 | 713 | std::string RP_join_path(const std::string &one, const std::string &two) { 714 | std::string result; 715 | std::string separator; 716 | #if defined(__RPISWINDOWS__) 717 | separator = "\\"; 718 | #elif defined(__RPISLINUX__) 719 | separator = "/"; 720 | #elif defined(__RPISAPPLE__) 721 | separator = "/"; 722 | #endif 723 | if (!RP_ends_with(one, separator) && !one.empty()) { 724 | result = one + separator; 725 | } else { 726 | result = one; 727 | } 728 | result.append(two); 729 | return result; 730 | } 731 | 732 | bool load_REFPROP(std::string &err, const std::string &shared_library_path, const std::string &shared_library_name) 733 | { 734 | // If REFPROP is not loaded 735 | if (RefpropdllInstance == NULL) 736 | { 737 | // Load it 738 | std::string msg; 739 | std::string shared_lib; 740 | if (shared_library_name.empty()) 741 | { 742 | shared_lib = get_shared_lib(); 743 | } else { 744 | shared_lib = shared_library_name; 745 | } 746 | #if defined(__RPISWINDOWS__) 747 | // Load the DLL 748 | TCHAR refpropdllstring[_MAX_PATH]; 749 | strcpy((char*)refpropdllstring, RP_join_path(shared_library_path, shared_lib).c_str()); 750 | RefpropdllInstance = LoadLibrary(refpropdllstring); 751 | // Error handling 752 | if (RefpropdllInstance == NULL) 753 | { 754 | std::stringstream msg_stream; 755 | msg_stream << GetLastError(); // returns error 756 | msg = msg_stream.str(); 757 | } else { 758 | TCHAR dllPath[_MAX_PATH]; 759 | HMODULE hModule; 760 | hModule = GetModuleHandle(refpropdllstring); 761 | GetModuleFileName(hModule, dllPath, _MAX_PATH); 762 | #ifndef UNICODE 763 | msg = dllPath; 764 | #else 765 | std::wstring wStr = dllPath; 766 | msg = std::string(wStr.begin(), wStr.end()); 767 | #endif 768 | RPPath_loaded = msg; 769 | } 770 | #elif ( defined(__RPISLINUX__) || defined(__RPISAPPLE__) ) 771 | // Load library 772 | RefpropdllInstance = dlopen (RP_join_path(shared_library_path, shared_lib).c_str(), RTLD_NOW); 773 | // Error handling 774 | if (RefpropdllInstance == NULL) 775 | { 776 | const char *errstr = dlerror(); 777 | if (errstr != NULL) 778 | { 779 | msg = errstr; 780 | } 781 | } else { 782 | RPPath_loaded = RP_join_path(shared_library_path, shared_lib); 783 | } 784 | #else 785 | RefpropdllInstance = NULL; 786 | RPPath_loaded = ""; 787 | msg = "Something is wrong with the platform definition, you should not end up here."; 788 | #endif 789 | 790 | if (RefpropdllInstance == NULL) 791 | { 792 | err = "Could not load REFPROP (" + shared_lib + ") due to: " + msg + ". "; 793 | err.append("Make sure the library is in your system search path. "); 794 | err.append("In case you run 64bit Windows and you have a REFPROP license, try installing the 64bit DLL from NIST. "); 795 | return false; 796 | } 797 | if (setFunctionPointers(err) != true) 798 | { 799 | err = "There was an error setting the REFPROP function pointers, check types and names in header file."; 800 | return false; 801 | } 802 | char rpv[versionstringlength] = { '\0' }; 803 | RPVersion(rpv, versionstringlength); 804 | RPVersion_loaded = rpv; 805 | return true; 806 | } 807 | return true; 808 | } 809 | 810 | bool unload_REFPROP(std::string &err) 811 | { 812 | // If REFPROP is loaded 813 | if (RefpropdllInstance != NULL) { 814 | #if defined(__RPISWINDOWS__) 815 | std::stringstream msg_stream; 816 | if (!FreeLibrary(RefpropdllInstance)) 817 | { 818 | msg_stream << GetLastError(); // returns error 819 | err = msg_stream.str(); 820 | return false; 821 | } 822 | #elif (defined(__RPISLINUX__) || defined(__RPISAPPLE__)) 823 | if (dlclose(RefpropdllInstance) != 0) 824 | { 825 | const char* errstr = dlerror(); 826 | if (errstr != NULL) 827 | { 828 | err = errstr; 829 | } 830 | return false; 831 | } 832 | #else 833 | err = "Something is wrong with the platform definition, you should not end up here."; 834 | return false; 835 | #endif 836 | RefpropdllInstance = NULL; 837 | RPVersion_loaded.clear(); 838 | RPPath_loaded.clear(); 839 | } 840 | return true; 841 | } 842 | 843 | /// The address of the REFPROP instance 844 | std::size_t REFPROP_address() { 845 | return reinterpret_cast(RefpropdllInstance); 846 | } 847 | 848 | #endif // REFPROP_IMPLEMENTATION 849 | 850 | #ifdef REFPROP_LIB_NAMESPACE 851 | }; /* namespace REFPROP_LIB_NAMESPACE */ 852 | #endif 853 | 854 | #endif // REFPROP_LIB_H 855 | -------------------------------------------------------------------------------- /REFPROP_underscore_lowercase_renaming.h: -------------------------------------------------------------------------------- 1 | #define RPVersion _rpversion 2 | #define SETPATHdll _setpathdll 3 | #define ABFL1dll _abfl1dll 4 | #define ABFL2dll _abfl2dll 5 | #define ACTVYdll _actvydll 6 | #define AGdll _agdll 7 | #define CCRITdll _ccritdll 8 | #define CP0dll _cp0dll 9 | #define CRITPdll _critpdll 10 | #define CSATKdll _csatkdll 11 | #define CV2PKdll _cv2pkdll 12 | #define CVCPKdll _cvcpkdll 13 | #define CVCPdll _cvcpdll 14 | #define DBDTdll _dbdtdll 15 | #define DBFL1dll _dbfl1dll 16 | #define DBFL2dll _dbfl2dll 17 | #define DDDPdll _dddpdll 18 | #define DDDTdll _dddtdll 19 | #define DEFLSHdll _deflshdll 20 | #define DHD1dll _dhd1dll 21 | #define DHFL1dll _dhfl1dll 22 | #define DHFLSHdll _dhflshdll 23 | #define DIELECdll _dielecdll 24 | #define DOTFILLdll _dotfilldll 25 | #define DPDD2dll _dpdd2dll 26 | #define DPDDKdll _dpddkdll 27 | #define DPDDdll _dpdddll 28 | #define DPDTKdll _dpdtkdll 29 | #define DPDTdll _dpdtdll 30 | #define DPTSATKdll _dptsatkdll 31 | #define DSFLSHdll _dsflshdll 32 | #define DSFL1dll _dsfl1dll 33 | #define ENTHALdll _enthaldll 34 | #define ENTROdll _entrodll 35 | #define ESFLSHdll _esflshdll 36 | #define FGCTYdll _fgctydll 37 | #define FGCTY2dll _fgcty2dll 38 | #define FUGCOFdll _fugcofdll 39 | #define FPVdll _fpvdll 40 | #define GERG04dll _gerg04dll 41 | #define GETFIJdll _getfijdll 42 | #define GETKTVdll _getktvdll 43 | #define GIBBSdll _gibbsdll 44 | #define HSFLSHdll _hsflshdll 45 | #define INFOdll _infodll 46 | #define LIMITKdll _limitkdll 47 | #define LIMITSdll _limitsdll 48 | #define LIMITXdll _limitxdll 49 | #define MELTPdll _meltpdll 50 | #define MELTTdll _melttdll 51 | #define MLTH2Odll _mlth2odll 52 | #define NAMEdll _namedll 53 | #define PASSCMN _passcmn 54 | #define PDFL1dll _pdfl1dll 55 | #define PDFLSHdll _pdflshdll 56 | #define PEFLSHdll _peflshdll 57 | #define PHFL1dll _phfl1dll 58 | #define PHFLSHdll _phflshdll 59 | #define PHIXdll _phixdll 60 | #define PHI0dll _phi0dll 61 | #define PQFLSHdll _pqflshdll 62 | #define PREOSdll _preosdll 63 | #define PRESSdll _pressdll 64 | #define PSFL1dll _psfl1dll 65 | #define PSFLSHdll _psflshdll 66 | #define PUREFLDdll _pureflddll 67 | #define QMASSdll _qmassdll 68 | #define QMOLEdll _qmoledll 69 | #define RESIDUALdll _residualdll 70 | #define REDXdll _redxdll 71 | #define RMIX2dll _rmix2dll 72 | #define SATDdll _satddll 73 | #define SATEdll _satedll 74 | #define SATGVdll _satgvdll 75 | #define SATHdll _sathdll 76 | #define SATPdll _satpdll 77 | #define SATSdll _satsdll 78 | #define SATTdll _sattdll 79 | #define SATTPdll _sattpdll 80 | #define SATSPLNdll _satsplndll 81 | #define SETAGAdll _setagadll 82 | #define SETKTVdll _setktvdll 83 | #define SETMIXdll _setmixdll 84 | #define SETMODdll _setmoddll 85 | #define SETREFdll _setrefdll 86 | #define SETUPdll _setupdll 87 | #define SPLNVALdll _splnvaldll 88 | #define SPLNROOTdll _splnrootdll 89 | #define SUBLPdll _sublpdll 90 | #define SUBLTdll _subltdll 91 | #define SURFTdll _surftdll 92 | #define SURTENdll _surtendll 93 | #define TDFLSHdll _tdflshdll 94 | #define TEFLSHdll _teflshdll 95 | #define THERM0dll _therm0dll 96 | #define THERM2dll _therm2dll 97 | #define THERM3dll _therm3dll 98 | #define THERMdll _thermdll 99 | #define THFLSHdll _thflshdll 100 | #define TPFLSHdll _tpflshdll 101 | #define TPFL2dll _tpfl2dll 102 | #define TPRHOdll _tprhodll 103 | #define TQFLSHdll _tqflshdll 104 | #define TRNPRPdll _trnprpdll 105 | #define TSFLSHdll _tsflshdll 106 | #define VIRBdll _virbdll 107 | #define VIRCdll _vircdll 108 | #define WMOLdll _wmoldll 109 | #define MASSdll _massdll 110 | #define MOLEdll _moledll 111 | -------------------------------------------------------------------------------- /generate_header.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | import subprocess, sys, six, os, re 3 | import numpy 4 | 5 | def generate_interface_file(REFPROP_FORTRAN_path, interface_file_path, verbose = False, python_exe = 'python'): 6 | """ 7 | Use f2py to parse PASS_FTN.FOR to generate a python-directed header file 8 | """ 9 | # Call f2py to generate .pyf file 10 | from subprocess import Popen, PIPE 11 | print('Writing the .pyf file with numpy.f2py, please be patient...') 12 | args = [python_exe,'-m','numpy.f2py','--quiet','--no-lower','-h',interface_file_path,REFPROP_FORTRAN_path] 13 | print('About to run:', ' '.join(args)) 14 | print('numpy version:', subprocess.check_output(' '.join([python_exe,'-c','"import numpy; print(numpy.__version__)"']), shell=True).strip().decode('ascii')) 15 | # Force an overwrite if the PYF target is older than the PASS_FTN.FOR 16 | if os.path.exists(interface_file_path) and os.path.getmtime(interface_file_path) < os.path.getmtime(REFPROP_FORTRAN_path): 17 | print('The .PYF file file is older; will be over-written') 18 | args += ['--overwrite-signature'] 19 | p = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) 20 | output, err = p.communicate() 21 | rc = p.returncode 22 | # If the REFPROP.pyf file was not generated successfully, that's an error 23 | if not os.path.exists(interface_file_path): 24 | if verbose: 25 | print(output) 26 | raise ValueError('Unable to call f2py successfully: '+str(err)) 27 | 28 | def find_subroutine(lines, lineno): 29 | istart = -1; iend = -1 30 | for i in range(lineno, len(lines)): 31 | if 'subroutine' in lines[i]: 32 | if istart < 0 and iend < 0: 33 | istart = i 34 | elif istart >= 0 and iend < 0: 35 | iend = i 36 | else: 37 | break 38 | 39 | if istart < 0 and iend < 0: 40 | return None 41 | 42 | # Example: "subroutine pureflddll(icomp) ! in c:\Program Files (x86)\REFPROP\fortran\PASS_FTN.FOR" 43 | # Example: "subroutine unsetagadll ! in c:\Program Files (x86)\REFPROP\fortran\PASS_FTN.FOR" 44 | splitted = lines[istart].split(' ') 45 | sub, name_arguments = splitted[0], splitted[1] 46 | if '(' in name_arguments: 47 | name, arguments = name_arguments.split('(') 48 | arguments = arguments.rstrip(')').split(',') 49 | else: 50 | name, arguments = name_arguments, [] 51 | 52 | argument_list, string_arguments = [], [] 53 | for offset, argument in enumerate(arguments): 54 | type, argname = lines[istart + 1 + offset].split(' :: ') 55 | 56 | """ 57 | Examples: 58 | character*10000 intent(in) :: hfiles 59 | integer intent(out) :: ierr 60 | double precision dimension(20),intent(in) :: x0 61 | """ 62 | # Split out the dimension and intent annotations 63 | matches = re.search(r'intent|dimension', type) 64 | intent_dimension = '' 65 | if matches: 66 | intent_dimension = type[matches.start(0)::] 67 | type = type[0:matches.start(0)] 68 | 69 | def get_dimension(intent_dimension): 70 | nummatches = re.findall(r'dimension\(+([0-9]*)\)+', intent_dimension) 71 | strmatches = re.findall(r'dimension\(+(\w*)\)+', intent_dimension) 72 | if nummatches: 73 | return nummatches[0] 74 | elif strmatches: 75 | return strmatches[0] 76 | else: 77 | raise ValueError('Unable to match dimension in this line:', intent_dimension) 78 | 79 | if 'character' in type: 80 | # Example: " character*10000 :: hfld" 81 | if type.strip() == 'character*(*)': 82 | string_length = -1 83 | else: 84 | string_length = int(type.split('*')[1]) 85 | string_arguments.append((argname.strip()+'_length', string_length)) 86 | argument_list.append((argname.strip(), 'char *')) 87 | elif 'integer' in type: 88 | L = 0; 89 | if 'dimension' in intent_dimension: 90 | L = get_dimension(intent_dimension) 91 | argument_list.append((argname.strip(), 'int *', L)) 92 | elif 'double' in type: 93 | L = 0; 94 | if 'dimension' in intent_dimension: 95 | L = get_dimension(intent_dimension) 96 | argument_list.append((argname.strip(), 'double *', L)) 97 | else: 98 | raise ValueError(lines[istart + 1 + offset].strip()) 99 | 100 | return dict(istart = istart, 101 | iend = iend, 102 | name = name, 103 | argument_list = argument_list, 104 | string_arguments = string_arguments 105 | ) 106 | 107 | def correct_name_case(name): 108 | """ Previously we had to modify the case; this function is a no-op now """ 109 | return name 110 | 111 | def arguments_to_string(args, string_arguments): 112 | outs = [] 113 | for arg in args: 114 | if len(arg) == 2: 115 | outs.append(arg[1]+arg[0]) 116 | elif len(arg) == 3: 117 | if arg[2] == 0: 118 | outs.append(arg[1]+arg[0]) 119 | else: 120 | outs.append(arg[1]+arg[0]+'/* ' + arg[2] + " */") 121 | else: 122 | print(arg) 123 | for arg in string_arguments: 124 | outs.append('int '+arg[0]+'/* ' + str(arg[1]) + " */") 125 | 126 | return ', '.join(outs) 127 | 128 | def generate_function_dict(pyf_file_path): 129 | """ 130 | Returns JSON data structure for the functions 131 | """ 132 | with open(pyf_file_path, 'r') as fp: 133 | lines = fp.readlines() 134 | funcs = {} 135 | output = True 136 | istart = 0 137 | while output is not None: 138 | output = find_subroutine(lines, istart) 139 | if output is not None: 140 | funcname = correct_name_case(output['name']) 141 | funcs[funcname] = output 142 | istart = output['iend']+1 143 | return funcs 144 | 145 | header = """ 146 | /* 147 | This file was generated by a script in http://github.com/CoolProp/REFPROP-headers 148 | originally written by Ian H. Bell, January 2016 149 | 150 | This header should work on windows and linux 151 | */ 152 | """ 153 | def write_header(function_dict, output_header_file): 154 | """ 155 | Use python to parse the generated interface file 156 | """ 157 | istart = 0 158 | ostring = header 159 | for function in sorted(function_dict.keys()): 160 | ostring += 'void ' + function + '(' + arguments_to_string(function_dict[function]['argument_list'],function_dict[function]['string_arguments']) + ');\n' 161 | 162 | with open(output_header_file,'w') as fp: 163 | fp.write(ostring) 164 | 165 | if __name__=='__main__': 166 | # Uncomment for local testing 167 | # sys.argv += ['--FORTRAN-path', r'R:/FORTRAN','--keep-pyf'] 168 | 169 | # Parse args first 170 | import argparse 171 | parser = argparse.ArgumentParser(description='Run the generator for .') 172 | parser.add_argument('--FORTRAN-path', nargs=1, required =True, default="", help="The directory containing the FORTRAN source files") 173 | parser.add_argument('--keep-pyf', nargs='?', const=True, default=False, help="If defined, the intermediate pyf file will be kept, otherwise it will be deleted") 174 | parser.add_argument('--python-exe', nargs=1, default=["python"], help="The python exe to be used to build the interface") 175 | args = parser.parse_args() 176 | 177 | # Change these paths as needed 178 | path_options = [os.path.join(args.FORTRAN_path[0],'PASS_FTN.FOR'), 179 | os.path.join(args.FORTRAN_path[0],'DLLFILES','PASS_FTN.FOR')] 180 | valid_paths = [path for path in path_options if os.path.exists(path)] 181 | if len(valid_paths) != 1: 182 | raise ValueError("Was not able to obtain a single valid path from the options: " + str(path_options)) 183 | generate_interface_file(valid_paths[0], 'REFPROP.pyf', python_exe = args.python_exe[0]) 184 | dd = generate_function_dict('REFPROP.pyf') 185 | 186 | write_header(dd,'REFPROP.h') 187 | if not args.keep_pyf: 188 | print('Deleting REFPROP.pyf') 189 | os.remove('REFPROP.pyf') 190 | -------------------------------------------------------------------------------- /generate_mangling_header.py: -------------------------------------------------------------------------------- 1 | with open('REFPROP_lib.h', 'r') as fp: 2 | lines = fp.readlines() 3 | newfile = '' 4 | for line in lines: 5 | if line.strip().startswith('X('): 6 | symb = line.rstrip('\\\n').strip().lstrip('X(').strip().rstrip(')') 7 | newfile += '#define' + ' ' + symb + ' _' + symb.lower() + '\n' 8 | with open('REFPROP_underscore_lowercase_renaming.h', 'w') as fp: 9 | fp.write(newfile) -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | 2 | // Only this file gets the implementation 3 | #define REFPROP_IMPLEMENTATION 4 | #define REFPROP_FUNCTION_MODIFIER 5 | #include "REFPROP_lib.h" 6 | #undef REFPROP_FUNCTION_MODIFIER 7 | #undef REFPROP_IMPLEMENTATION 8 | 9 | #include 10 | #include 11 | 12 | // Prototype from the other file 13 | void another_file(const std::string &, const std::string &); 14 | 15 | int main() 16 | { 17 | // You may need to change this path to suit your installation 18 | // Note: forward-slashes are recommended. 19 | std::string path = "D:/Program Files (x86)/REFPROP"; 20 | std::string DLL_name = "REFPRP64.dll"; 21 | 22 | // Call a function in another file (and load the DLL, and then unload it) 23 | another_file(path, DLL_name); 24 | 25 | // Load the shared library 26 | std::string err; 27 | 28 | bool loaded_REFPROP = load_REFPROP(err, path, DLL_name); 29 | printf("Loaded refprop (in main.cpp): %s @ address %zu\n", loaded_REFPROP ? "true" : "false", REFPROP_address()); 30 | if (!loaded_REFPROP){ 31 | return EXIT_FAILURE; 32 | } 33 | 34 | SETPATHdll(const_cast(path.c_str()), 400); 35 | 36 | int ierr = 0, nc = 2; 37 | char herr[255], hfld[10000] = "AMMONIA|WATER", hhmx[255] = "HMX.BNC", href[4] = "DEF"; 38 | SETUPdll(nc,hfld,hhmx,href,ierr,herr,10000,255,3,255); 39 | if (ierr > 0) printf("This ierr: %d herr: %s\n", ierr, herr); 40 | { 41 | int ierr = 0; 42 | char herr[255]; 43 | double z[20] = {1.0}, x[20] = {1.0}, y[20] = {1.0}, T= 300, p = 101.325, d = -1, dl = -1, dv = -1, h = -1, s = -1, u = -1, cp = -1, cv = -1, q = -1, w = -1; 44 | TPFLSHdll(T, p, z, d, dl, dv, x, y, h,s,u,cp,cv,w,q,ierr,herr,255); 45 | if (ierr > 0) printf("This ierr: %d herr: %s\n", ierr, herr); 46 | printf("This d: %g mol/L\n", d); 47 | { 48 | double T = 293.15; double z[20] = { 0.20209999999999995, 0.7979}; int kph = 1; 49 | double P, rhol, rhov; 50 | double x[20], y[20]; 51 | int ierr; char herr[255]; 52 | SATTdll(T, z, kph, P, rhol, rhov, x, y, ierr, herr, 255); 53 | printf("This p: %g mol/L\n", p); 54 | } 55 | } 56 | 57 | // Call a function in another file (and load the DLL, and then unload it) 58 | another_file(path, DLL_name); 59 | 60 | return EXIT_SUCCESS; 61 | } 62 | -------------------------------------------------------------------------------- /other.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "REFPROP_lib.h" 3 | #include 4 | #include 5 | 6 | void another_file(const std::string & path, const std::string &DLL_file) 7 | { 8 | 9 | // Load the shared library 10 | std::string err; 11 | bool loaded_REFPROP = load_REFPROP(err, path, DLL_file); 12 | printf("Loaded refprop (in other.cpp): %s @ address %zu\n", loaded_REFPROP ? "true" : "false", REFPROP_address()); 13 | 14 | // Set the loading path 15 | SETPATHdll(const_cast(path.c_str()), 400); 16 | 17 | int ierr = 0, nc = 1; 18 | char herr[255], hfld[10000] = "R32.FLD", hhmx[255] = "HMX.BNC", href[255] = "DEF"; 19 | SETUPdll(nc,hfld,hhmx,href,ierr,herr,10000,255,3,255); 20 | if (ierr > 0) printf("Other ierr: %ld herr: %s\n", ierr, herr); 21 | { 22 | int ierr = 0; 23 | char herr[255]; 24 | double z[20] = {1.0}, x[20] = {1.0}, y[20] = {1.0}, T= 300, p = 101.325, d = -1, dl = -1, dv = -1, h = -1, s = -1, u = -1, cp = -1, cv = -1, q = -1, w = -1; 25 | TPFLSHdll(T, p, z, d, dl, dv, x, y, h,s,u,cp,cv,w,q,ierr,herr,255); 26 | if (ierr > 0) printf("Other ierr: %ld herr: %s\n", ierr, herr); 27 | printf("Other d: %g mol/L\n", d); 28 | } 29 | 30 | bool unloaded_REFPROP = unload_REFPROP(err); 31 | printf("Unloaded refprop (in other.cpp): %s\n", loaded_REFPROP ? "true" : "false"); 32 | } 33 | -------------------------------------------------------------------------------- /scrape_PASS_FTN.py: -------------------------------------------------------------------------------- 1 | """ 2 | A script to scrape all the function exports from the PASS_FTN.FOR 3 | 4 | By Ian Bell, NIST, January 2018 5 | """ 6 | import os 7 | from generate_header import generate_interface_file, generate_function_dict 8 | 9 | if __name__=='__main__': 10 | generate_interface_file('R:/FORTRAN/PASS_FTN.FOR','REFPROP.PYF',verbose=False,python_exe='python') 11 | funcs = generate_function_dict('REFPROP.PYF') 12 | for func in sorted(funcs): 13 | print(' X(' + func + ') \\') 14 | 15 | for func in sorted(funcs): 16 | string_lengths = [] 17 | types = [] 18 | for arg in funcs[func]['argument_list']: 19 | if len(arg) == 3: 20 | name, _type, size = arg 21 | else: 22 | name, _type = arg 23 | size = 0 24 | if _type == 'double *' and size == 0: 25 | types.append('DOUBLE_REF') 26 | elif _type == 'double *' and size != 0: 27 | types.append('double *') 28 | elif _type == 'int *' and size == 0: 29 | types.append('INT_REF') 30 | elif _type == 'int *' and size != 0: 31 | types.append('int *') 32 | elif _type == 'char *': 33 | types.append('char *') 34 | string_lengths.append('RP_SIZE_T') 35 | else: 36 | print(types) 37 | raise ValueError() 38 | print(' '*4+'#define '+func+'_ARGS '+','.join(types+string_lengths)) -------------------------------------------------------------------------------- /testRP.m: -------------------------------------------------------------------------------- 1 | 2 | % Path to directory containing REFPROP.h header file 3 | path_to_include= '.'; 4 | % Path to directory containing librefprop.so (change as needed) 5 | path_to_lib = '.'; 6 | 7 | % Loading shared library 8 | if ~libisloaded('REFPROP') %checking whether library is already loaded 9 | addpath(path_to_lib) 10 | addpath(path_to_include) 11 | libname = 'REFPRP64'; % OSX and linux 12 | if ~ispc 13 | libname = 'libREFPRP64'; 14 | end 15 | loadlibrary(libname,'REFPROP.h','includepath',path_to_include,'alias','refprop'); % loading library with alias coolprop 16 | disp('loaded REFPROP shared library.') 17 | disp('loaded these functions: ') 18 | libfunctions refprop 19 | end 20 | % Uncomment this line to see all the functions exported by REFPROP and 21 | % their arguments 22 | %libfunctionsview refprop 23 | 24 | ncmax = 20; 25 | herr_size = 255; 26 | ierr = 0; 27 | ncomp = 1; 28 | 29 | fluid = 'WATER.FLD'; 30 | hmx = 'HMX.BNC'; 31 | ref = 'DEF'; 32 | b = (1:1:buffer_size); 33 | herr = char(b); 34 | 35 | [ncomp,fluid,hmx,ref,ierr,herr] = calllib('refprop','SETUPdll',ncomp,fluid,hmx,ref,ierr,herr,10000,255,3,herr_size); 36 | 37 | t = 300; % [K] 38 | p = 101.325; %[kPa] 39 | 40 | z = zeros(1,ncmax); 41 | z(1) = 1.0; % Pure water 42 | 43 | d = 0; dl = 0; dv = 0; q = 0; e = 0; h = 0; s = 0; cv = 0; cp = 0; w = 0; 44 | 45 | % Pointer to the mole fractions 46 | pz = libpointer('doublePtr',z); 47 | x = libpointer('doublePtr',zeros(1, ncmax)); 48 | y = libpointer('doublePtr',zeros(1, ncmax)); 49 | 50 | [t, p, pz, d, dl, dv, x, y, q, e, h, s, cv, cp, w, ierr, herr] = calllib('refprop','TPFLSHdll', t, p, pz, d, dl, dv, x, y, q, e, h, s, cv, cp, w, ierr, herr, herr_size); 51 | disp(s) 52 | --------------------------------------------------------------------------------