On 25 Mar 2002, Peter Dimitrov wrote:
> Hi all,
>
> First, I want to apologize if this question has been already answered. I
> have a RedHat 7.2. system with recently patched version of R-1.4.1. I'm
> in a process of writing R package, say X, that loads some C++ code.
> Currently, while adding functionality to it in both R and C++ sources,
> I'm getting crashes every time I detach/load/access the C++
function(s).
> Typical transcript follows:
>
> > library(X)
> Loading required package: mva
> > is.loaded("exp_dist_fast") # The name of the C stub function
> [1] TRUE
> > detach(package:X)
> > is.loaded("exp_dist_fast")
> [1] TRUE # Problem?
> > library(X) # Load X after changes in the C/C++ code
> > is.loaded("exp_dist_fast") # or
.C("exp_dist_fast",...)
>
> Process R:1 segmentation fault at Mon Mar 25 12:17:57 2002
>
> What is the way to cleanly unload the object code and is there better
> mechanism than detach(package:X)?
Does you package use .Last.lib to unload your shared library, X.so?
If not, that will probably be your problem, as library.dynam will not
reload it (and you probably use library.dynam).
Take a look at package tcltk for an example.
I'm not sure what Linux does if you change a shared library that is in
use, but it is not a good idea (and fatal on Solaris, for example).
--
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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._