Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapper for Julia 0.3 #473

Closed
JonWel opened this issue Feb 18, 2015 · 1 comment
Closed

Wrapper for Julia 0.3 #473

JonWel opened this issue Feb 18, 2015 · 1 comment
Milestone

Comments

@JonWel
Copy link
Contributor

JonWel commented Feb 18, 2015

The current Julia wrapper is only compatible for Julia 0.4 (development version), and not compatible with Julia 0.3.
The only difference is that they changed the way to write the unsigned integer.
The old way was Uint and the new way is UInt. So while the new way should be kept for Julia 4, it would be interesting to have a version of the wrapper compatible with the current Julia release.

I tested this on Ubuntu 14.10 64bit and Julia 0.3.5 and the PropsSI function worked fine:

module CoolProp

export F2K, HAPropsSI, PropsSI, PhaseSI

function F2K(TF::Float64)
  return ccall( (:F2K, "CoolProp"), Cdouble, (Cdouble,), TF)
end

function HAPropsSI(Output::String, Name1::String, Value1::Float64, Name2::String, Value2::Float64, Name3::String, Value3::Float64)
  return ccall( (:HAPropsSI, "CoolProp"), Cdouble, (Ptr{Uint8},Ptr{Uint8},Float64,Ptr{Uint8},Float64,Ptr{Uint8},Float64), Output,Name1,Value1,Name2,Value2,Name3,Value3)
end

function PropsSI(Output::String, Name1::String, Value1::Float64, Name2::String, Value2::Float64, Fluid::String)
  return ccall( (:PropsSI, "CoolProp"), Cdouble, (Ptr{Uint8},Ptr{Uint8},Float64,Ptr{Uint8},Float64,Ptr{Uint8}), Output,Name1,Value1,Name2,Value2,Fluid)
end

function PhaseSI(Name1::String, Value1::Float64, Name2::String, Value2::Float64, Fluid::String)
  outstring = Array(Uint8, 255)
  val = ccall( (:PhaseSI, "CoolProp"), Int32, (Ptr{Uint8},Float64,Ptr{Uint8},Float64,Ptr{Uint8}, Ptr{Uint8}, Int), Name1,Value1,Name2,Value2,Fluid,outstring,length(outstring))
  return bytestring(convert(Ptr{Uint8}, outstring))
end

end #module

(I only changed the UInt8 by Uint8)

@jowr
Copy link
Member

jowr commented Feb 18, 2015

Yes, that is also what was recommended here. Maybe we should add it to the docs...
#447 (comment)

@jowr jowr closed this as completed in b7deae1 Feb 18, 2015
@ibell ibell added this to the v5.0.8 milestone Feb 20, 2015
@ibell ibell changed the title Wrapper for Julia 3 Wrapper for Julia 0.3 Feb 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants