From roebuck at mdanderson.org  Wed Oct 26 17:22:07 2005
From: roebuck at mdanderson.org (Paul Roebuck)
Date: Wed, 26 Oct 2005 10:22:07 -0500 (CDT)
Subject: [Rd] pb with dyn.load - fortran code now attached
In-Reply-To: <200510261514.40235.gilles.guillot@inapg.inra.fr>
References: <200510261514.40235.gilles.guillot@inapg.inra.fr>
Message-ID: <Pine.OSF.4.58.0510260951360.171503@wotan.mdacc.tmc.edu>

On Wed, 26 Oct 2005, Gilles GUILLOT wrote:

> QUESTION 1:
> [guillot at laplace guillot]$ R
> R : Copyright 2005, The R Foundation for Statistical Computing
> Version 2.2.0  (2005-10-06 r35749)
> ISBN 3-900051-07-0
>
>  >system("R CMD SHLIB ~/tmp/test1.f")
> g77   -fPIC  -g -O2 -c /home/guillot/tmp/test1.f -o /home/guillot/tmp/test1.o
> gcc -shared -L/usr/local/lib
> -o /home/guillot/tmp/test1.so /home/guillot/tmp/test1.o  -lg2c -lm -lgcc_s
> > system("R CMD SHLIB ~/tmp/test2.f")
> g77   -fPIC  -g -O2 -c /home/guillot/tmp/test2.f -o /home/guillot/tmp/test2.o
> gcc -shared -L/usr/local/lib
> -o /home/guillot/tmp/test2.so /home/guillot/tmp/test2.o  -lg2c -lm -lgcc_s
> >
> > is.loaded("sub")
> [1] FALSE
> > is.loaded("sub_")
> [1] FALSE
> >
> ## OK
> > dyn.load("~/tmp/test1.so")
> > is.loaded("sub")
> [1] FALSE
> > is.loaded("sub_")
> [1] TRUE
> >
> ## it seems it does not comply with the 'value' section of the help
> ## of function is.loaded:
> ## "it needs the
> ##    name you would give to '.C' or '.Fortran' and *not* that remapped
> ##    by 'symbol.C' and 'symbol.For'."
> ##
> ## am i missing something ?
> > q()

The is.loaded method needs the argument to look exactly
like the associated output from 'nm' (i.e., symbol name).

$ nm ~/tmp/test1.so | grep sub

Thus, you are manually asking for the following

> is.loaded(symbol.For("sub"))

The call to .Fortran use the (lowercase) name of the subroutine
as it would appear in the Fortran source code.

.Fortran("sub", ...)

----------------------------------------------------------
SIGSIG -- signature too long (core dumped)



[Rd] pb with dyn.load - fortran code now attached
Paul Roebuck