[Rd] symbol.For problem? (PR#7974)

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Tue Jun 28 08:25:53 CEST 2005


You are not using symbol.For correctly.  Both .Fortran and symbol.For
append an underscore if one is needed:

> symbol.For("add")
[1] "add_"

so you are looking for "add__" which will not be in the function table.

The help file says

      Functions 'symbol.C' and 'symbol.For' map function or subroutine
      names to the symbol name in the compiled code.  These are no
      longer of much use in R.

      'is.loaded' checks if the symbol name is loaded and hence
      available for use in '.C' or '.Fortran': nowadays it needs the
      name you would give to '.C' or '.Fortran' and *not* that remapped
      by 'symbol.C' and 'symbol.For'.

On Tue, 28 Jun 2005 jbremson at neyman.ucdavis.edu wrote:

> It seems as though 'symbol.For' does not work correctly.

Please read the section on BUGS in the FAQ and do not file bug reports on 
things about which you are not _certain_, as it asks.

>
>> library("foo")
>> add(3,4)
> [1] 7
>> sym.add(3,5)
>
> Error in .Fortran(symbol.For("add"), as.numeric(a), as.numeric(b), c = as.numeric(0)) :
>        "Fortran" function name not in load table
>
> The function 'add' is a R wrapper to a simple fortran 77 subroutine that adds two numbers.
> In 'add' the .Fortran call looks like this:
> 	.Fortran("add",...)
>
> In 'sym.add' the .Fortran call looks like this:
> 	.Fortran(symbol.For("add"),...)
>
> symbol.For works correctly if there is an underscore in the name though.
>
> I have tested this on OSX and linux and get the same results.
>
> I have a test package written up if anyone wants it. Email me
> at jbremson at wald.ucdavis.edu.
>
>
>
>
> --please do not edit the information below--
>
> Version:
> platform = i686-pc-linux-gnu
> arch = i686
> os = linux-gnu
> system = i686, linux-gnu
> status =
> major = 2
> minor = 1.0
> year = 2005
> month = 04
> day = 18
> language = R
>
> Search Path:
> .GlobalEnv, package:foo, package:methods, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, Autoloads, package:base
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
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-devel mailing list