Would it be an option for PRIK to generate a Fortran shim routine?
subroutine capture() bind(c)
use state, only: a
! ... read/write to a via USE association ...
end subroutine
It is a bit complicated but essentially you’d need to invoke a callback each time you had to do something with a, in the spirit of this answer: Accessing derived-data type array components via pointers - #8 by jwmwalrus