I wanted to use the dist() function from the mva library in my own
library, so I put require(mva) in my files. When my library loads, a
message about "Autoloading ... mva" appears. But when I call dist() now
within my functions the message
Error in .C("dist", as.double(x), nrow(x), ncol(x), double(len),
as.integer(method)) : C/Fortran function not in load table
appears.
After dyn.load("..._path_to_/mva.so") it works.
Is there something wrong with the autoloading process or should
statements like `if (!is.loaded("dist")) {dynload("mva.so")}` be added to
the functions of the mva library? Or is this problem due to a wrong setup
in my R (0.50a4)?
Albrecht
------------------------------------------------------------------
Albrecht Gebhardt email: albrecht.gebhardt at uni-klu.ac.at
Institut fuer Mathematik Tel. : (++43 463) 2700/837
Universitaet Klagenfurt Fax : (++43 463) 2700/834
Villacher Str. 161
A-9020 Klagenfurt, Austria
------------------------------------------------------------------
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
R-beta: autoloading a required library
4 messages · Thomas Lumley, Albrecht Gebhardt
On Mon, 17 Nov 1997, Albrecht Gebhardt wrote:
I wanted to use the dist() function from the mva library in my own
library, so I put require(mva) in my files. When my library loads, a
message about "Autoloading ... mva" appears. But when I call dist() now
within my functions the message
Error in .C("dist", as.double(x), nrow(x), ncol(x), double(len),
as.integer(method)) : C/Fortran function not in load table
appears.
After dyn.load("..._path_to_/mva.so") it works.
It's probably something wrong with the setup, but I don't know what. It seems to work in my installation of R which is roughly 0.50a4. Does it work if you use library(mva) instead? This should be identical except that it gives an error if "mva" doesn't exist, rather than a warning. gorn% R R : Copyright 1997, Robert Gentleman and Ross Ihaka Version 0.50 Alpha-4 (September 10, 1997) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type "license()" for details. [Previously saved workspace restored]
is.loaded("dist")
[1] FALSE
require(mva)
Autoloading required library: mva [1] TRUE
is.loaded("dist")
[1] TRUE
and even if the require() is inside a function
ff<-function(x) require(mva)
is.loaded("dist")
[1] FALSE
ff(1)
Autoloading required library: mva [1] TRUE
is.loaded("dist")
[1] TRUE
-thomas =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=---
On Mon, 17 Nov 1997, Thomas Lumley wrote:
On Mon, 17 Nov 1997, Albrecht Gebhardt wrote:
I wanted to use the dist() function from the mva library in my own
library, so I put require(mva) in my files. When my library loads, a
message about "Autoloading ... mva" appears. But when I call dist() now
within my functions the message
Error in .C("dist", as.double(x), nrow(x), ncol(x), double(len),
as.integer(method)) : C/Fortran function not in load table
appears.
After dyn.load("..._path_to_/mva.so") it works.
It's probably something wrong with the setup, but I don't know what. It seems to work in my installation of R which is roughly 0.50a4. Does it work if you use library(mva) instead? This should be identical except that it gives an error if "mva" doesn't exist, rather than a warning. gorn% R R : Copyright 1997, Robert Gentleman and Ross Ihaka Version 0.50 Alpha-4 (September 10, 1997) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type "license()" for details. [Previously saved workspace restored]
is.loaded("dist")
[1] FALSE
require(mva)
Autoloading required library: mva [1] TRUE
is.loaded("dist")
[1] TRUE
This works (but not within the workspace, where my problem occured).
and even if the require() is inside a function
ff<-function(x) require(mva)
is.loaded("dist")
[1] FALSE
ff(1)
Autoloading required library: mva [1] TRUE
is.loaded("dist")
[1] TRUE
the same behavior. Now I tried loading my library within a new .RData workspace and everything worked, but only the first time I use this workspace. The second time i get: R : Copyright 1997, Robert Gentleman and Ross Ihaka Version 0.50 Alpha-4 (September 10, 1997) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type "license()" for details. [Previously saved workspace restored]
is.loaded("dist")
[1] FALSE
library(sgeostat)
Autoloading required library: mva Autoloading required library: scompat
is.loaded("dist")
[1] FALSE
ls(all=T)
[1] ".Dyn.libs" ".Provided" .Dyn.libs was created the first time I used this workspace and contains (immediatly after the second start of R):
.Dyn.libs
[1] "mva.so" Maybe this is the reason why "mva.so" did not get loaded. Does R forget to clear ".Dyn.libs" on shutdown? Albrecht ------------------------------------------------------------------ Albrecht Gebhardt email: albrecht.gebhardt at uni-klu.ac.at Institut fuer Mathematik Tel. : (++43 463) 2700/837 Universitaet Klagenfurt Fax : (++43 463) 2700/834 Villacher Str. 161 A-9020 Klagenfurt, Austria ------------------------------------------------------------------ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=---
On Mon, 17 Nov 1997, Albrecht Gebhardt wrote:
Maybe this is the reason why "mva.so" did not get loaded. Does R forget to clear ".Dyn.libs" on shutdown?
Umm, yes. I'd forgotten that particular bug. The quick fix is to add
if (exists(".Dyn.libs")) .Dyn.libs<-NULL
to the startup file
The solution was to put .Dyn.libs in the System environment instead of the
Global environment so it doesn't get saved. I believe this is fixed in
the next version of R, due out roughly now.
-thomas
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=---
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=---