[R] passing char's from C to Fortran (mac os x)

Ingmar Visser i.visser at uva.nl
Mon Jul 5 16:19:02 CEST 2004


Hello All,

In some package I use a c-routine which calls a fortran routine which
expects a char-string as input.

As per the writing R-extensions manual,
the Fortran routine is declared in C as:
void F77_NAME (setoptions) (char **option);

and then it is calles as follows:

   char **option; 
   option = new char*[1];
   option[0] = new char[256];
   option[0] = strcpy(option[0],"Iteration Limit = 100");
   Rprintf(option[0]);
   F77_CALL (setoptions) (option);

Unfortunately this does not work, ie the fortran routine setoptions does
not correctly get the intended character string. Can anyone point me to a
working example  of passing characters from C to Fortran? Or tell me what's
wrong in my code above?

My platform is below, I use R CMD INSTALL to compile and install the
complete package.

thanks in advance, ingmar visser

platform powerpc-apple-darwin6.8
arch     powerpc   
os       darwin6.8 
system   powerpc, darwin6.8
status             
major    1         
minor    9.0       
year     2004      
month    04        
day      12        
language R




More information about the R-help mailing list