Use coarrays with a C main program

At least to get a single image version working with the Intel compiler, you can try,

// Routines from libifcore
extern void for_rtl_init_(int *, char **);
extern int for_rtl_finish_();

extern void some_caf_subroutine(); // Fortran procedure using coarrays

int main(int argc, char **argv) {
  for_rtl_init_(&argc, argv);
  some_caf_subroutine();
  for_rtl_finish_(); // ignore status
  return 0;
}

When compiling with your C compiler, you’ll need to add the path of the Intel Fortran runtime libraries:

LDFLAGS=-L/opt/intel/oneapi/compiler/2024.0/lib
LDLIBS=-lifcore -licaf -ldl

main: main.c some_caf_subroutine.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)