-
-
Notifications
You must be signed in to change notification settings - Fork 6
Make C prototypes #25
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
base: develop
Are you sure you want to change the base?
Conversation
There is an interface mismatch: subroutine precicef_set_vertex(meshName, position, vertexID, meshNameLength) &
& bind(c, name='precicef_set_vertex_')
use, intrinsic :: iso_c_binding
character(kind=c_char), dimension(*) :: meshName
real(kind=c_double) :: coordinates(3) !<--- this should be named position
integer(kind=c_int) :: id !<--- this should be named vertexID
integer(kind=c_int), value :: meshNameLength
end subroutine precicef_set_vertex Because of Fortran language rules (...) the With gfortran you can use |
To detect inconsistencies, you would need to compile Afterward, if you compile with Here's an example of what happens: https://godbolt.org/z/EMWPExjjn. It appears like you need to have This means that either the CI in this repository should check-out the precice trunk, or the precice trunk checks out this repository, and does the consistency check. |
Hm... I did not think of checking the names of the variables... 😅
That's very useful information, thank you!
Very good suggestion, I added that to our Makefiles, thanks!
I will then update the bindings in preCICE itself as well, but then this will need to wait. (context: we are preparing releases of several components this week, I will continue with anything that needs changes in preCICE after that) |
Discussion summary:
|
With this PR,
make prototype
will generate aprecice-prototype.h
file. This includes warnings for non-interoperable types, as, for example:Not sure where the
float
comes from, I don't see it in any of the involved files:precice.f90
precice/precice/extras/bindings/fortran/
precice/precice/extras/bindings/c/
Applies https://fortran-lang.discourse.group/t/compilers-supporting-generation-of-c-function-prototypes/2688 suggested by @ivan-pi.
Not sure at the moment what would be the best way to use the generated prototype to detect inconsistencies. I need more time to investigate, which I currently do not have.
When complete, it should close #15.