Hi,
I have been able to write gcc-code that uses the RefrigC.dll in
http://www.et.dtu.dk/WinDali/Files/RefEqns_3.10.ZIP
This library code has been written in Delphi and it has been used from
both the Salford and the MS fortran compilers. However both of these
have extensions which makes it possible to specify which input types the
dll functions expect.
C as well makes it possible to specify this as:
extern __int32 SetRNumber(char* ANum);
extern __int32 GetRNumber(char* ANum);
extern double PDewT(double T);
extern double TDewP(double P);
extern double SDewT(double T);
extern __int32 TVSP(double S,double P,double* T,double* V);
With g77 I see no way to specify this and it seems that I have to
specify it to use the dlls.
The following compiles and links but outputs only rubbish when running
the program:
program refrig
implicit none
external SetRNumber
external GetRNumber
external PDewT
external TDewP
external SDewT
external TVSP
double precision PDewT
double precision TDewP
double precision SDewT
character*200 AName
double precision ps,ts,ss,vs,tsnew
Call SetRNumber('R134a')
call GetRNumber(AName)
print*,'Refrigerant: ',AName
print*,'-------------------------'
ts = 273.15
ps = PDewT(ts)
ts = TDewP(ps)
print*,'PDew [bar] : ',ps/1E5
print*,'TDew [C] : ',ts-273.15
print*,'-------------------------'
ss = SDewT(ts)
call TVSP(ss,ps,tsnew,vs)
print*,'SS [kJ/kg] : ',ss/1E3
print*,'TSNew [C] : ',tsnew-273.15
print*,'PSNew [bar] : ',ps/1E5
print*,'VSNew [m^-3] : ',vs
print*,' '
end
Is there a way out or do I have to write a c-function to interface a dll
from gcc?
Regards,
Brian
|