When compiling user-defined data types containing a FINAL subroutine with a calling convention other than default such as /iface:cvf, the build fails with the error
error #5522: FINAL subroutines must be defined with the default calling convention
(a) Is this a Fortran standard requirement or an IVF-imposed restriction?
(b) Is there a workaround other than commenting out FINAL routines for compilation with the /iface:cvf option?
The Fortran standard has no concept of calling convention (beyond that BIND(C) is required for C interoperable procedures).
You can specify that the final procedure use default calling convention with `!DEC$ ATTRIBUTES DEFAULT :: name_of_final_procedure` inside the final procedure body.
@IanH - Thanks. The suggestion worked perfectly. Using !DEC$ ATTRIBUTES DEFAULT :: mysub allows /iface:cvf to be used for the project without the error above.
One other observation is that the FINAL subroutine is invoked when a variable that is defined in another subroutine (standalone or contained) goes out of scope but not for a variable in a main program when execution ends. I presume the finalization does not cover the termination of the main program itself since the compiler would be automatically "finalizing" in any case.
Correct - variables declared in the scope of the main program do not get finalized.