To: J3 12-111r2 From: Malcolm Cohen/Bill Long Subject: TS 29113 Non-interoperable procedure arguments Date: 2012 February 14 References: N1830, 11-251r1, 12-119 INTRODUCTION: 11-251r1 added support for non-interoperable callback routines to TS 29113 (based on DIN-4 PDTS feedback); however this support is incomplete: C_F_PROCPOINTER lacks the possibility to recover a noninteroperable function pointer within Fortran. This paper attempts to add the missing bits to the TS. EDITS to 12-119: In the title for 8.1, replace "C_F_POINTER, ... C_FUNLOC" by "ISO_C_BINDING module procedures" -------------- In 8.1 after paragraph 1 add new paragraph: "The function C_F_PROCPOINTER from the intrinsic module ISO_C_BINDING has the restriction in ISO/IEC 1539-1:2010 that CPTR and FPTR shall not be the C address and interface of a noninteroperable Fortran procedure." -------------- In 8.1 after the final paragraph add a new paragraph: "If the value of a C function pointer will be the result of a reference to C_FUNLOC with a noninteroperable argument, it is recommended that the C function pointer be declared with a prototype of \cf{void (*funptr_name)()}." --------------- In 8.7 Interoperability of procedures ... before the final paragraph, add a new paragraph: "A C function shall not invoke a function pointer whose value is the result of a reference to C_FUNLOC with a noninteroperable argument." --------------- In 9.9 Edits to Clause 15, in the edit "Before subclause 15.5" change "8.3 to 8.7" to "8.3 to 8.6" and change "15.5 to 15.9" to "15.5 to 15.8". {8.7 is not suitable for direct inclusion in this way; there are already separate edits implementing 8.7.} --------------- In 9.9 Edits to Clause 15, Insert these edits in the correct subclause order: --- {In 15.2.3.4 C_F_PROCPOINTER, paragraph 3} In the description of argument CPTR, after " that is interoperable" insert "or the result of a reference to C_FUNLOC with a noninteroperable argument". In the description of argument FPTR, replace "The interface for FPTR shall be interoperable with the prototype that describes the target of CPTR." with "If the target of CPTR is interoperable, the interface for FPTR shall be interoperable with the prototype that describes that target. Otherwise, the interface for FPTR shall have the same characteristics as that target." --- {At the end of 15.5.1 Definition and reference of interoperable procedures, insert a new paragraph:} "If the value of a C function pointer will be the result of a reference to C_FUNLOC with a noninteroperable argument, it is recommended that the C function pointer be declared with a prototype of \cf{void (*funptr_name)()}." ----------------- 9.9 Edits to Clause 15, edit for 15.5.1 paragraph 4, after "A C function shall not invoke a" replace "Fortran ... interoperable" with "a function pointer whose value is the result of a reference to C_FUNLOC with a noninteroperable argument." ===END===