To: J3 12-111r1 From: Bill Long Subject: TS 29113 Non-interoperable procedure arguments Date: 2012 February 13 References: N1830, 11-251r1, 11-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 11-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 two new paragraphs: "The function C_F_PROCPOINTER from the intrinsic module ISO_C_BINDING has the restriction in ISO/IEC 1539-1:2010 that the procedure with the C address of CPTR shall be interoperable. The function C_F_PROCPOINTER from the intrinsic module ISO_C_BINDING has the restriction in ISO/IEC 1539-1:2010 that the interface of its FPTR argument shall be interoperable with the prototype that describes the target of CPTR." -------------- In 8.1 after the final paragraph add a NOTE: NOTE 8.1 It is recommended that a C function pointer corresponding to a Fortran entity \cf{funptr_name} of type C_FUNPTR is declared with a prototype of the form \cf{void (*funptr_name)()} if the interface of its target is not interoperable." --------------- 8.7 Interoperability of procedures ... Before the final paragraph, add a new paragraph: "A C function shall not invoke a Fortran procedure that is not interoperable. A Fortran procedure shall not invoke a C function that is not interoperable." --------------- 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, delete " that is interoperable". In the description of argument FPTR, delete "The interface for FPTR shall be interoperable with the prototype that describes the target of CPTR." --- {At the end of 15.5.1 Definition and reference of interoperable procedures, insert a new note} "NOTE 15.23+ It is recommended that a C function pointer corresponding to a Fortran entity \cf{funptr_name} of type C_FUNPTR is declared with a prototype of the form \cf{void (*funptr_name)()} if the interface of its target is not interoperable." ----------------- 9.9 Edits to Clause 15, In the current edit for 15.5.1, after the sentence "A C function shall not invoke a Fortran procedure that is not interoperable." add a new sentence "A Fortran procedure shall not invoke a C function that is not interoperable."