[R-sig-hpc] Fortran, MPI, and calling R functions via RInside

Ei-ji Nakama nakama at ki.rim.or.jp
Tue Mar 1 07:28:08 CET 2016


Hi,

>       INTERFACE
>          SUBROUTINE R_FUN(argc,argv) bind(C, name="buzzyC")
>            use iso_c_binding
>         character(kind=c_char), INTENT(INOUT) :: argv
>         INTEGER(kind=c_int), INTENT(IN) :: argc
>
>       END SUBROUTINE R_FUN
>     END INTERFACE

it would need to be revised following if the above definition.

> extern "C" void buzzyC(int argc,char *argv[]) {

extern "C" void buzzyC(int *argc,char *argv) {

this case will be receive an int pointer of the C side.
# omit argv...

maybe you want receive the value of the INT(not pointer), add the
VALUE attribute.
Its defined as follows...
           INTEGER(kind=c_int), VALUE, INTENT(IN) :: argc

Best Regards,
--
Eiji NAKAMA <nakama (a) ki.rim.or.jp>
"\u4e2d\u9593\u6804\u6cbb"  <nakama (a) ki.rim.or.jp>



More information about the R-sig-hpc mailing list