Some success with the C main interface, but still the finalization is not working. It worked only without finalization
Following is the partially working C main
#include <stdio.h>
extern void coarray_hello(); // Fortran subroutine
extern void _gfortran_caf_init();
//extern void _gfortran_caf_finish();
void main(int *argc, char ***argv) {
_gfortran_caf_init(&argc, &argv);
printf("Calling Fortran coarray subroutine from C...\n");
coarray_hello();
//_gfortran_caf_finish();
}
If you notice finalization has been commented. I got following partial output on run
Calling Fortran coarray subroutine from C…
** Hello from image 1 of 4**
Calling Fortran coarray subroutine from C…
** Hello from image 2 of 4**
We get error due to missing of finalization in C main.
Help me in getting rid of this error.