From a29e3aeea01c04d9b3df2d85cb9bdaba1e73ecee Mon Sep 17 00:00:00 2001 From: Bruce Wernick Date: Sun, 13 Dec 2015 08:26:28 +0200 Subject: [PATCH] Update cpIntf.pas --- wrappers/Delphi/cpIntf.pas | 53 ++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/wrappers/Delphi/cpIntf.pas b/wrappers/Delphi/cpIntf.pas index 2caf4b1a..2e9a1e3a 100644 --- a/wrappers/Delphi/cpIntf.pas +++ b/wrappers/Delphi/cpIntf.pas @@ -1,6 +1,14 @@ { Delphi Interface for CoolProp - Bruce Wernick, 10 December 2015 + Bruce Wernick, 13 December 2015 + + Notes: + All of the char parameters are PAnsiChar, the floating point numbers are + Double and the integer types are either LongInt or Integer depending on the + type in the dll. Where there is an output string, the calling program must + create the space for the result. Be aware here that insufficient space will + result in a empty string. So for example, you should ensure sufficient space + for the refrigerant list. } unit cpIntf; @@ -10,41 +18,42 @@ interface const cpdll = 'CoolProp.dll'; -type - CoolChar = AnsiChar; - PCoolChar = PAnsiChar; - CoolStr = AnsiString; - CoolVec = array[0..1023] of CoolChar; - function get_global_param_string( - param: PCoolChar; - var res: CoolVec; + param: PAnsiChar; + res: PAnsiChar; n: Integer): LongInt; stdcall; external cpdll name '_get_global_param_string@12'; function get_fluid_param_string( - fluid: PCoolChar; param: PCoolChar; - var Output: CoolVec; + fluid: PAnsiChar; + param: PAnsiChar; + res: PAnsiChar; n: Integer): Longint; stdcall; external cpdll name '_get_fluid_param_string@12'; -function PropsSI(spec: PCoolChar; - prop1: PCoolChar; val1: Double; - prop2: PCoolChar; val2: Double; - ref: CoolStr): Double; stdcall; +function PropsSI( + spec: PAnsiChar; + prop1: PAnsiChar; val1: Double; + prop2: PAnsiChar; val2: Double; + fluid: PAnsiChar): Double; stdcall; external cpdll name '_PropsSI@32'; -function Props1SI(spec: PCoolChar; - ref: CoolStr): Double; stdcall; +function Props1SI( + fluid: PAnsiChar; + res: PAnsiChar): Double; stdcall; external cpdll name '_Props1SI@8'; -function HAPropsSI(spec: PCoolChar; - prop1: PCoolChar; val1: Double; - prop2: PCoolChar; val2: Double; - prop3: PCoolChar; val3: Double): Double; stdcall; +function HAPropsSI( + spec: PAnsiChar; + prop1: PAnsiChar; val1: Double; + prop2: PAnsiChar; val2: Double; + prop3: PAnsiChar; val3: Double): Double; stdcall; external cpdll name '_HAPropsSI@40'; implementation -begin +initialization + {Disable floating point exception + This is a problem with the Delphi compiler only} + Set8087CW($133f); end.