similar to: Using .onUnload() to unload compiled code

Displaying 20 results from an estimated 1000 matches similar to: "Using .onUnload() to unload compiled code"

2010 Sep 16
1
Possible bug or annoyance with library.dynam.unload()
Hello, I have a package with a namespace. Because I use Roxygen that overwrites the NAMESPACE file each time it is run, I use a R/zzz.R file with an .onLoad() and .onUnload() functions to take care of loading and unloading my shared library. The problem: if I load my library from a local directory, then the unloading of the package fails, e.g: # loads fine >library(Foo,
2012 Jul 24
1
Using .onUnload to unload DLLs
I've noticed that many of the "base" R packages have an .onUnload() function which automatically unloads compiled shared libraries with library.dynam.unload(). For example: > stats:::.onUnload function (libpath) library.dynam.unload("stats", libpath) <bytecode: 0x1033b9c30> <environment: namespace:stats> I've noticed that many other packages don't
2016 May 06
2
Is it possible to increase MAX_NUM_DLLS in future R releases?
Thanks for all your great answers. The app I?m working on is indeed an exploratory data analysis tool for gene expression, which requires a bunch of bioconductor packages. I guess for now, my best solution is to divide my app into modules and load/unload packages as the user switch from one module to another. This brought me another question: it seems that unload package with the
2016 Mar 25
1
library.dynam.unload
The survival package has a firstlib.R file that I had forgotton and just reviewed. After deleting several bits which had a use 10 years ago during my Splus to R transition, the only thing remaining is .onUnload <- function(libpath) library.dynam.unload("survival", libpath) Does this bit of code still serve a purpose? Can I toss it? Terry T.
2017 Sep 28
1
rgl crash on windows 7
I have a co-worker who has installed R 3.4.2 on Windows 7. When this person tries to load the rgl package with library(rgl) A dialog box appears with the message: R for windows gui frontend has stopped working I suspect a conflict problem with a dll, but I'm not sure how to identify if this is the problem since R is crashing immediately. Interestingly, when we start R and do NOT load rgl,
2010 Nov 12
1
unloading compiled code.
I have a package that I'm developing that I need to unload the library. Long story short I figured out that the leaving the compiled code loaded lead to a segmentation fault, but unloading the code will fix it. I've read the documentation and it appears that there are several ways to do this? What is the popper accepted current standard for unloading compiled code? The options as I
2007 Jul 03
2
reinforce library to re-load
Hi, I am wondering if there is a parameter in library() so that it can reinforce package to be reloaded. It helps when you test your modified package by yourself. Otherwise, my way is to re-start Rgui. (by reading ?library, I understand this option is not implemented) "...Both functions check and update the list of currently loaded packages and do not reload a package which is already
2007 Jul 03
2
reinforce library to re-load
Hi, I am wondering if there is a parameter in library() so that it can reinforce package to be reloaded. It helps when you test your modified package by yourself. Otherwise, my way is to re-start Rgui. (by reading ?library, I understand this option is not implemented) "...Both functions check and update the list of currently loaded packages and do not reload a package which is already
2009 Feb 19
1
How to unload a dll loaded via library.dynam()?
Hello. To save the hassle of quitting and restarting R every time I rebuild the package I'm working on (for the purposes of this question called "roots") I would like to write a script cleanly remove the package from my R session and then load it again. Of course detach("package:roots") works for the native R objects in the package. However, the compiled C library remains
2009 Feb 19
1
How to unload a dll loaded via library.dynam()?
Hello. To save the hassle of quitting and restarting R every time I rebuild the package I'm working on (for the purposes of this question called "roots") I would like to write a script cleanly remove the package from my R session and then load it again. Of course detach("package:roots") works for the native R objects in the package. However, the compiled C library remains
2016 May 04
2
Is it possible to increase MAX_NUM_DLLS in future R releases?
On 04/05/2016 08:44, Martin Maechler wrote: >>>>>> Qin Zhu <qinzhu at outlook.com> >>>>>> on Mon, 2 May 2016 16:19:44 -0400 writes: > > > Hi, > > I?m working on a Shiny app for statistical analysis. I ran into this "maximal number of DLLs reached" issue recently because my app requires importing many other packages.
2014 Nov 11
0
Should R Packages Unload Dynamic Libraries When They Unload?
>From Hadley's C best practices (http://r-pkgs.had.co.nz/src.html#c-best-practices): > Like with C++, whenever you use C code in your package, you should unload the DLL when the package is unloaded: .onUnload <- function (libpath) { library.dynam.unload("mypackage", libpath) } Writing R Extensions on the other hand doesn't even mention this (AFAIK). I
2005 Nov 11
0
(kind of OT) Equivalent to onunload or onbeforeunload in Safari?
I realize this isn''t specifically a Rails question, but I figure others here will have encountered it. I have a client that wants form data to be saved when leaving a page. This could include leaving a page by following a link, closing a window, or pressing the back or forwards buttons. So ... I do some research, and found this Web page:
2009 Mar 31
4
what is the preferred method to create a package local variable?
for the moment, I'm using: .onAttach <- function(libname, pkgname) { .bbg.db.conn <<- dbConnect(dbDriver("PostgreSQL"), user="blah","blah") } .onUnload <- function(libpath) { dbDisconnect(.bbg.db.conn) } which results in a hidden global variable in the global environment. I would prefer to make the assignment only in the package namespace.
2008 Aug 18
2
Call a Fortran subroutine with R: R crashes
Hello, I am trying to call a FORTRAN subroutine within R and something really strange happens: I have a dll-library, that I load with dyn.load('mpbvv.dll'). I have checked the [Ordinal/Name Pointer] Table for the function within the library that I want to call - it is there (objdump - p mpbvv.dll). Then, I have written an R-wrapper to call the FORTRAN subroutine, which works fine. SInce
2019 Dec 03
1
Dynamic load library problem using R 4.0.0
I'm having problems getting code that runs under 3.6.1 on MacOSX (and Ubuntu) to run the R version 4.0.0 on Windows. I have not tested R 4.0.0 on mac (yet). Key question: Has anything changed in R 4.0.0/Windows regarding how dynamically loaded libraries are accessed? Can someone please point me in the right direction? WORKS On MacOSX Under: R version 3.6.1 (2019-07-05) -- "Action of
2016 May 10
0
Is it possible to increase MAX_NUM_DLLS in future R releases?
>>>>> Qin Zhu <qinzhu at outlook.com> >>>>> on Fri, 6 May 2016 11:33:37 -0400 writes: > Thanks for all your great answers. > The app I?m working on is indeed an exploratory data analysis tool for gene expression, which requires a bunch of bioconductor packages. > I guess for now, my best solution is to divide my app into modules and
2006 Jan 08
4
repeat { readline() }
Hi. Using Rterm v2.2.1 on WinXP, is there a way to interrupt a call like repeat { readline() } without killing the Command window? Ctrl+C is not interrupting the loop: R : Copyright 2006, The R Foundation for Statistical Computing Version 2.2.1 Patched (2006-01-01 r36947) <snip></snip> > repeat { readline() } ^C ^C ^C ^C On Unix it works. The problem seems to get the
2008 Apr 24
4
Scriptaculous Help (page exit effects)
I was wondering if it was possible in Prototype/Scriptaculous to run an effect when a link is clicked, then go to that page, or if it was possible to have an effect run when the page unloads. I have tried <body onunload="new Effect.Fade("whatever");> and some prototype page exit events, could get a alert("") function to work, but not the effects. Any ideas?
2007 Jan 16
2
on.exit called on loading ?
I just found out that an .onLoad() function such as this stylized one (where I just renamed some identifiers) .onLoad <- function(lib, pkg) { require(zoo, quiet=TRUE, warn.conflicts=FALSE) library.dynam("foolib", pkg, lib ) if (.Platform$OS.type != "windows") { initSomeServices() } if (.Platform$OS.type != "windows") {