Thanks for the replies folks. Moving C_F_PROCPOINTER
up into callback_wrapper gave me issues with ifx, although I’m having trouble producing a minimum working example at the moment.* Unfortunately I can’t do workaround 2 either because in actual fact I want the closure to be passed to a Fortran function and I’d like for the signature of the closure to note have anything to do with C interop. Given that ifort will soon not be supported we might just drop support for it altogether.
Something I’m curious about though, is that fact that it works in gfortran and other compilers when both value attributes are removed. Is this a bug or intended behavior?
* Edit: Managed to get a working example, the key was adding the “-assume recursive” flag: Strange issue with ifx compiler and '-assume recursion'"