Skip to content

recommendation for fortran code #1

@smoothdeveloper

Description

@smoothdeveloper

you can use bind(C) on function and subroutine definition.

also, when passing scalar values, you can annotate them with `value``

function add(a,b) bind(C) result(c)
  integer(kind=4), intent(in), value :: a,b
  integer(kind=4) :: c
  c = a + b
end function

value means the argument is passed by value, rather than pointer

this would be equivalent to

int32_t add(int32_t a, int32_t b);

I think this way you can skip most of the .h files, unless haskell relies on them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions