(j3.2006) A few constants from ISO_Fortran_env for C interop

Van Snyder Van.Snyder
Mon Oct 24 14:43:39 EDT 2011


One of my colleagues is working on some software that needs to be told
the Fortran I/O unit to which output should be written.

For two of the destinations, he wants the defaults to be OUTPUT_UNIT and
ERROR_UNIT from ISO_Fortran_env.

The unit numbers are set in a structure.

He'd like to be able to use the code from C, so he's written a BIND(C)
interface layer.

A question he asked, that I couldn't answer, is how the C program knows
the values of OUTPUT_UNIT and ERROR_UNIT.

Should we add these values (and maybe a few more from ISO_Fortran_env)
to ISO_Fortran_binding.h?

An alternative is to ask the C caller to call a BIND(C) Fortran
procedure that returns the values.  That seems a bit like a kluge.





More information about the J3 mailing list