Hello,
I am trying to call a simple Opencoarrays program with non Fortran main based on Making sure you're not a bot! this wiki. Just wanted your help, after compiling coarray part using -fcoarray=lib, compiling c parts gives error. Following is the error
libcaf.h:236:31: error: expected ‘)’ before ‘,’ token
236 | void PREFIX (register) (size_t, caf_register_t, caf_token_t *,
| ^
| )
main.c: In function ‘main’:
main.c:11:5: error: implicit declaration of function ‘gfortran_caf_init’ [-Wimplicit-function-declaration]
11 | gfortran_caf_init(*argc, ***argv);
| ^~~~~~~~~~~~~~~~~
main.c:16:5: error: implicit declaration of function ‘gfortran_caf_finish’ [-Wimplicit-function-declaration]
16 | gfortran_caf_finish ();
I am attaching the fortran file
coarray_module.f90 (338 Bytes)
The C calling code is
#include <stdio.h>
#include <libcaf.h> // Include the header file
extern void coarray_hello(); // Fortran subroutine
int main(int *argc, char ***argv) {
_gfortran_caf_init(*argc, ***argv);
printf("Calling Fortran coarray subroutine from C...\n");
coarray_hello();
_gfortran_caf_finish ();
return 0;
}
Somehow this part is not compiling, and giving error.
@rouson Just your feedback, what I am attempting is correct or not. Your valuable feedback in making it working will be very helpful.
Best Regards
Apurva