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

Lionel, Steve steve.lionel
Mon Oct 24 14:53:47 EDT 2011


This doesn't make a lot of sense to me - the unit numbers can be used only from Fortran code, so the C code has to call Fortran anyway.  How much of ISO_FORTRAN_ENV needs to be communicated to C?  KIND types?  IOSTAT values for EOR? A user function to return the values seems quite appropriate in this case.

Steve

-----Original Message-----
From: j3-bounces at j3-fortran.org [mailto:j3-bounces at j3-fortran.org] On Behalf Of Van Snyder
Sent: Monday, October 24, 2011 2:44 PM
To: j3
Subject: (j3.2006) A few constants from ISO_Fortran_env for C interop

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.


_______________________________________________
J3 mailing list
J3 at j3-fortran.org
http://j3-fortran.org/mailman/listinfo/j3




More information about the J3 mailing list