mutable struct AbstractState #mutable, to register finalizers
handle::Clong
function AbstractState(x::Integer)
res = new(Clong(x))
finalizer(AbstractState_free,res) #register finalizer, to free up memory when `AbstractState` goes out of scope
return res
end
end
function AbstractState_free(x::AbstractState)
return AbstractState_free(x.handle)
end
function PropsSI(val1,prop1,val2,prop2,fluid::AbstractState)
# do low level call, fluid is mutated
end
when using
PropsSI, a new abstract state is created with each call. one option would be to do something like: