[R] passing char to Fortran routine

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Oct 10 17:35:12 CEST 2005


> PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

Programming questions are appropriate for R-devel, as it says there.

The issue is OS-specific, but we don't see what your Fortran code is.
If you send a reproducible example to the R-devel list, people may be able 
to suggest what the problem is.

On Mon, 10 Oct 2005, Ingmar Visser wrote:

> Hello all,
>
> I am using an existing Fortran routine that takes a single character string
> as argument. The routine echoes the argument that I provide. When working on
> OS X 3.9 there seems to be no problem, ie the Fortran routine nicely echoes
> my argument. However, I compiled the same package on a PC (using all the
> tools provided in the R for windows faq), and the routine only echoes the
> first letter of each character string that I pass on to it.
>
> My questions are:
> 1) Is this somehow compiler specific?
> 2) Should I explicitly provide the Fortran routine with the length of the
> character string?
> 3) I am at a loss as to what is happening here, so any hint is welcome (-;
>
> The call to the Fortran routine is as follows:
>
> .Fortran("npoptn",as.character(opt),PACKAGE="depmix")
>
> where opt is a character string such as opt="Iteration limit = 100"

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list