Comments (5)
What's the API of the REFPROPdll
function (is it really called like that?)? What are the types of hFld
, hIn
, hOut
, iUnits
, iMass
, iFlag
, a
, b
, z
? Also, did you read https://docs.julialang.org/en/v1/manual/calling-c-and-fortran-code/ including all the caveats about Fortran?
from julia.
I don't know the dll, but generally Fortran expects arguments to be passed by reference. I.e. a pointer to the data. So Cint
, Cdouble
etc. might be inappropriate. I would try to specify the type as Ptr{Cint}
and pass it as Ref(iUnits)
etc. What it does about strings I do not know. It depends, I suspect.
from julia.
It looks like the main problem is the lack of necessary parameters.
Doc for REFPROPdll
https://refprop-docs.readthedocs.io/en/latest/DLL/high_level.html#f/_/REFPROPdll
#define RP_SIZE_T std::size_t
#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
There are some wrappers written in other languages for reference:
https://github.com/usnistgov/REFPROP-wrappers
from julia.
What's the API of the
REFPROPdll
function (is it really called like that?)? What are the types ofhFld
,hIn
,hOut
,iUnits
,iMass
,iFlag
,a
,b
,z
? Also, did you read https://docs.julialang.org/en/v1/manual/calling-c-and-fortran-code/ including all the caveats about Fortran?
The (Fortran) types of those parameters are char*, char*, char*, int, int, int, double, double, array(double)* respectively. I have read the docs, thanks for the link.
I don't know the dll, but generally Fortran expects arguments to be passed by reference. I.e. a pointer to the data. So
Cint
,Cdouble
etc. might be inappropriate. I would try to specify the type asPtr{Cint}
and pass it asRef(iUnits)
etc. What it does about strings I do not know. It depends, I suspect.
Thanks for this advice, I messed around with parameter types and which to send as pointers and that got me past the error. I'm still having another error (read-only memory), but this was definitely an improvement.
It looks like the main problem is the lack of necessary parameters.
Doc for
REFPROPdll
https://refprop-docs.readthedocs.io/en/latest/DLL/high_level.html#f/_/REFPROPdll
#define RP_SIZE_T std::size_t #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_TThere are some wrappers written in other languages for reference: https://github.com/usnistgov/REFPROP-wrappers
I am confident I have the input parameters correct (except for type conversion), as I have worked with this DLL extensively in other languages. Most of those parameters you see in the #define result are outputs, not inputs.
Apologies for the screenshot, but here are the parameters defined in the documentation:
from julia.
As pointed out by @inkydragon, the ABI appears incorrect. This isn't really the kind of thing you can't just guess at. In particular different fortran compilers will sometimes implement ABIs differently, so the documention is not sufficient to determine the ABI. @inkydragon's reference to the C headers is likely your best bet for translation. Regardless, this is not a bug, so future discussion on this is best had at https://discourse.julialang.org/.
from julia.
Related Issues (20)
- Error when instantiating environment: "compiled/v1.12/RegressionTests/L2wCO_p4MmI.ji" No such file or directory HOT 1
- Wrong number of methods after redefinition of function HOT 2
- libunwind ld warning during build and incorrect line numbers in stacktrace HOT 1
- `@fastmath` and `literal_pow` not compatible HOT 1
- Source link 404 HOT 1
- 1.11.0-alpha2: problems with precompilation HOT 3
- Destructed arguments cannot be properly used to define optional arguments HOT 1
- Missing documentation: sortperm! is not truly non-allocating unless scratchspace is provided HOT 6
- `x < min(x, y)` HOT 11
- Illegal instruction on 1.10.2 but not 1.11+ HOT 3
- Unreachable reached at 0x7b92c0862a74 / Illegal instruction
- Illegal instruction crash
- Defining `==` for `ComposedFunction` by comparing `inner` and `outer` HOT 1
- the GenericMemory doc string isn't included in the docs HOT 3
- Add `mul_hi` HOT 10
- Building from fresh clone with `USECCACHE=1` fails
- `Base.FastMath.pow_fast(a::Float64, i::Int)` fails for huge `i` HOT 6
- Parallel precompile shows stacktrace into precompilation code when a package fails to precompile
- Parallel precompile now seems to fail precompiling the package itself HOT 9
- Broadcasts over `StepRange` of `Date/DateTime` materialize to vectors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from julia.