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_vertexBecause 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:
|
| $(F03) -c -fimplicit-none $^ | ||
|
|
||
| prototype: precice.f90 | ||
| $(F03) -fimplicit-none -fc-prototypes -fsyntax-only $^ -I../.. $(shell pkg-config --libs libprecice) > precice-prototype.h |
There was a problem hiding this comment.
We could also use -fc-prototypes-external -fsyntax-only for checking prototypes not declared with bind(c).
However, this only works for external functions (thus, not here, because we are in a module).
With this PR,
make prototypewill generate aprecice-prototype.hfile. This includes warnings for non-interoperable types, as, for example:Not sure where the
floatcomes from, I don't see it in any of the involved files:precice.f90precice/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.