[R] Shared Library Error
Martin Maechler
maechler at stat.math.ethz.ch
Sat May 24 10:41:59 CEST 2008
>>>>> "witn" == what's in the name? <born.to.b.wyld at gmail.com>
>>>>> on Sat, 24 May 2008 02:47:02 -0500 writes:
witn> R.version gives the following output
>> R.version
witn> _ platform x86_64-unknown-linux-gnu
witn> arch x86_64 os linux-gnu system x86_64, linux-gnu
witn> status major 2 minor 6.0 year 2007 month 10 day 03 svn
witn> rev 43063 language R version.string R version 2.6.0
witn> (2007-10-03)
witn> If you see my previous email, I did try .Fortran with
witn> removing the last underscore, and I still got the same
witn> error. I made the .so file using the f95 compiler. In
witn> fact, 'nm *.so | grep xtabs', did show up the the name
witn> "merge_xtabs_patterns_file_ ". I am using f95 because
witn> my source code is written in f90.
But in that case, I'd almost bet that
.Fortran("merge_xtabs_patterns_file", ....)
will work. The idea being that you use the same name as in the
fortran code, namely with*OUT* trailing "_".
Regards,
Martin Maechler, ETH Zurich
witn> Interestingly, doing the same works on another
witn> machine, even though the f95 compiler on the two
witn> machines is the same. R.version on that machine gives:
>> R.version
witn> _ platform i686-pc-linux-gnu arch i686
witn> os linux-gnu system i686, linux-gnu status major 2
witn> minor 6.2 year 2008 month 02 day 08 svn rev 44383
witn> language R version.string R version 2.6.2 (2008-02-08)
witn> So, I am now wondering if this is a problem with the
witn> older version of R which has now being fixed.
witn> Please comment.
witn> Thanks, A
witn> On Sat, May 24, 2008 at 2:30 AM, Prof Brian Ripley
witn> <ripley at stats.ox.ac.uk> wrote:
>> The problem is that underscore is an illegal symbol in a
>> Fortran 77 name (and R only requires a Fortran 77
>> compiler).
>>
>> You have not told us your OS nor R version nor
>> compiler+version (because what a compiler does with this
>> is a compiler-specific extension).
>>
>> You should not be using the trailing underscore in
>> .Fortran, so the failure was correct.
>>
>> Some changes have been made fairly recently, and my
>> belief is that this does work correctly in R-patched,
>> even for old compilers such as gcc3's g77. But it is not
>> portable and not really supported.
>>
>> So either try a current version of R-patched or write
>> legal Fortran 77.
>>
>>
>>
>> On Fri, 23 May 2008, what's in the name? wrote:
>>
>> Can anyone help me resolve this? A part of the R function
>> looks like this:
>>>
>>> print(is.loaded('merge_xtabs_patterns_file'))
>>> print(is.loaded('merge_xtabs_patterns_file_'))
>>>
>>>
>>> .Fortran('merge_xtabs_patterns_file_',ydim[1],ydim[2],x=as.integer(as.matrix(y)),na=as.integer(c),
>>>
>>> maxD=as.integer(maxD),lrowmem=length(rowmem),rowmem=as.integer(rowmem),
>>>
>>> sequential=as.integer(Sequential),nclust=as.integer(nclust))
>>>
>>>
>>>
>>>
>>> The corresponding output:
>>>
>>> [1] FALSE [1] TRUE Error in
>>> .Fortran("merge_xtabs_patterns_file_", ydim[1], ydim[2],
>>> x = as.integer(as.matrix(y)), : Fortran symbol name
>>> "merge_xtabs_patterns_file_" not in load table
>>>
>>>
>>>
>>>
>>>
>>> Why is it that I get a TRUE for is.loaded with the same
>>> symbol, but when using that under .Fortran I get the
>>> above error?
>>>
>>>
>>> I also tried replacing the third line with the following
>>> (removing the last underscore from the symbol name):
>>>
>>>
>>> .Fortran('merge_xtabs_patterns_file',ydim[1],ydim[2],x=as.integer(as.matrix(y)),na=as.integer(c),
>>>
>>> maxD=as.integer(maxD),lrowmem=length(rowmem),rowmem=as.integer(rowmem),
>>>
>>> sequential=as.integer(Sequential),nclust=as.integer(nclust))
>>>
>>>
>>> The corresponding error:
>>>
>>> Error in .Fortran("merge_xtabs_patterns_file", ydim[1],
>>> ydim[2], x = as.integer(as.matrix(y)), : Fortran symbol
>>> name "merge_xtabs_patterns_file" not in load table
>>>
>>>
>>>
>>> Can anyone help?
>>>
>>> Thanks, A
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
>>> read the posting guide
>>> http://www.R-project.org/posting-guide.html and provide
>>> commented, minimal, self-contained, reproducible code.
>>>
>>>
>> --
> Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied
>> Statistics,
>> http://www.stats.ox.ac.uk/~ripley/<http://www.stats.ox.ac.uk/%7Eripley/>
>> University of Oxford, Tel: +44 1865 272861 (self) 1 South
>> Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax:
>> +44 1865 272595
>>
[[alternative HTML version deleted]]
witn> ______________________________________________
witn> R-help at r-project.org mailing list
witn> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
witn> read the posting guide
witn> http://www.R-project.org/posting-guide.html and
witn> provide commented, minimal, self-contained,
witn> reproducible code.
More information about the R-help
mailing list