Displaying 20 results from an estimated 2000 matches similar to: "multiple packages using the same native code."
2024 May 28
1
How to call directly "dotTcl" C-function of the tcltk-package from the C-code of an external package?
I have a use case with tcltk-package where I need to repeatedly call Tcl/Tk functions
very quickly. For such purpose, the standard R-interface turned out to be too slow, and
better option has been to call package's C-function dotTcl directly from my own C-code.
Before R 4.4.0 it was possible to use getNativeSymbolInfo("dotTcl","tcltk")$address (or
2004 Sep 20
1
problem typcasting return of R_ExternalPtrAddr(SEXP s)
In the odesolve routine lsoda(), I allow the function (named func) that calculates the system of differential equations to be defined in a dll that has been dynamically loaded from the file named in dllname. I use getNativeSymbolInfo(func, dllname)$address to get the address of the function and pass it to a C function called via the .Call interface. Inside that C function, I use
2011 Sep 14
2
External pointers and an apparent memory leak
I'm using external pointers and seemingly leaking memory. My determination of a memory leak is that the R process continually creeps up in memory as seen by top while the usage as reported by gc() stays flat. I have isolated the C code:
void h5R_allocate_finalizer(SEXP eptr) {
Rprintf("Calling the finalizer\n");
void* vector = R_ExternalPtrAddr(eptr);
free(vector);
2024 May 30
1
How to call directly "dotTcl" C-function of the tcltk-package from the C-code of an external package?
I asked Tomas.
Apparently this works:
getNativeSymbolInfo("dotTcl",PACKAGE=getLoadedDLLs()$tcltk)
and the tcltk behavior was changed by
r84265 | hornik | 2023-04-15 08:44:36 +0200 (Sat, 15 Apr 2023) | 1 line
Try forcing symbols in ff calls.
Index: library/tcltk/src/init.c
===================================================================
--- library/tcltk/src/init.c
2010 Feb 18
3
R CMD check: OK in LINUX. Crashes in Windows!
Hi,
I have followed the recommended steps for creating a package (rctest). As of
now, my goal is simply to understand how various pieces fit together. The
package includes:
(1) C code with source in sub-directories, compiled to create a static
library.
(a) There is a single C-struct (dns) a simple 'matrix': {int m; int n;
double *d;}
(b) C code to create random matrix of a certain size.
2001 Dec 13
3
R-1.4.0: how to use getSymbolInfo()?
I have a package that solves systems of ordinary differential equations
coded as an R function (odesolve, on CRAN). The function is passed to R
code, and c and Fortran code called by it uses lang4() and eval() to
evaluate the R function inside a compiled c function to use in a
compiled ODE solver. This works quite well, but can be slow.
I'd like to be able to supply the name of a compiled
2014 Jan 22
1
Linking to native routines in other packages
Dear all,
in my package 'stochvol' I have unsuccessfully been trying to make a C
routine called 'sampler' available to be called from other packages' C code.
Following
http://cran.r-project.org/doc/manuals/R-exts.html#Linking-to-native-routines-in-other-packages
I have included
#include <R_ext/Rdynload.h>
R_init_stochvol(DllInfo *dll) {
2011 Aug 17
3
getNativeSymbolInfo("user_unif_rand") returns different results on windows and linux
Hi,
When loading a package that provides the user-supplied RNG hook
user_unif_rand, calling getNativeSymbolInfo("user_unif_rand") returns
informations about the loaded symbol.
I am using this to identify which package currently provides the RNG hook.
The results are the same on windows and linux if only one library
provides the hook.
If one loads a second package that provides this
2008 Apr 09
1
getNativeSymbolInfo fails with Fortran symbol.
In the following code routine 'initaquaphy' is defined in Fortran,
and dynamically loaded into R.:
test.f:
subroutine initaquaphy(odeparms)
external odeparms
double precision pars(19)
common /myparms/pars
call odeparms(19, pars)
return
end
$ R CMD SHLIB Aquaphy.f
gfortran -fpic -g -O2 -c test.f -o test.o
gcc -std=gnu99 -shared
2017 May 09
2
registering Fortran routines in R packages
Dear list,
I?m trying to register Fortran routines in randtoolbox (in srt/init.c file), see https://r-forge.r-project.org/scm/viewvc.php/pkg/randtoolbox/src/init.c?view=markup&root=rmetrics.
Reading https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Registering-native-routines and looking at what is done in stats package, I first thought that the following code will do the job:
2002 Sep 06
3
explict sharing of symbols between packages
Hi everyone,
I'm thinking about breaking up a large package I have to
avoid loading some of the more specialised parts when it
isn't necessary.
The package is dependent on shared libraries. The base one
will keep all of the core stuff like constructors etc and
the specialised parts will need to access these. It is
obviously possible to set the "local" flag to false, however
2012 Sep 28
1
Annotate a segmented linear regression plot
Hello,
I have produced some segmented regressions with the segmented package by
Viggo Mutteo. I have some example data and code below. I want to annotate
the individual segments with the slope parameter (actually it would be
nicer to annotate with 1000*slope and add some small amount of text as
well). How can I do it? Reading the docs for segmented I can access all of
the slope parameters via a
2005 Feb 13
2
row equality.
I think that this is an easy one...
I have a matrix where each row is an (x,y,z) triplet. Given a potential
(xnew,ynew,znew) triplet I want to know if the matrix already contains a
row with the new values (the space already has that point). I can do it
using a for loop, but I would like to know if there is anyway in which I
can do it without the for loop.
I do it now like this (this
2017 Dec 29
3
winbuilder warning message wrt function pointers
I've recently updated the coxme package, which calls internal routines from the bdsmatrix
package.? (It is in fact mentioned as an example of this in the Extensions manual.)
The call connections are a blocks like this, one for each of the 9 called C routines.
void bdsmatrix_prod4(int nrow,??? int nblock,?? int *bsize,
??????????????????? double *bmat, double *rmat,
??????????????????? int
2016 May 14
2
R external pointer and GPU memory leak problem
My question is based on a project I have partially done, but there is still something I'm not clear.
My goal is to create a R package contains GPU functions (some are from Nividia cuda library, some are my self-defined CUDA functions)
My design is quite different from current R's GPU package, I want to create a R object (external pointer) point to GPU address, and run my GPU function
2017 May 10
3
registering Fortran routines in R packages
Thanks for your email.
I try to change the name in lowercase but it conflicts with a C implementation also named halton. So I rename the C function halton2() and sobol2() while the Fortran function are HALTON() and SOBOL() (I also try lower case in the Fortran code). Unfortunately, it does not help since I get
init.c:97:25: error: use of undeclared identifier 'halton_'; did you mean
2017 Dec 29
1
winbuilder warning message wrt function pointers
And remove the cast on the return value of R_GETCCallable. And check
that your function is found before using it.
#include <R.h>
#include <Rinternals.h>
#include <R_ext/Rdynload.h>
void bdsmatrix_prod4(int nrow, int nblock, int *bsize,
double *bmat, double *rmat,
int nfrail, double *y) {
DL_FUNC fun = NULL;
if (fun==NULL)
2012 Feb 06
1
Segfault on ".C" registration via R_CMethodDef according to 'Writing R Extensions'.
Dear R List,
I encountered a serious problem regarding the registration of ".C" when following the documentation "Writing R Extensions"
that leads to a segmentation fault (tested on windows and mac os x).
The registration mechanism for ".C" routines via R_registerRoutines and
the R_CMethodDef structure has been enhanced recently with the
addition of two fields, one
2003 Oct 10
1
number of arguments in .Call function registration
I initially sent this to the biocore mailing list - but it was
suggested that r-devel would also find it interesting.
Many of us use a macro like
#define CALL_DEF(fname, nargs) { #fname, (DL_FUNC)&fname, nargs}
for use in function registration for use with .Call.
For example, using the example from R Extension manual,
if we want to register a C function myCall with three arguments, we
2007 Jul 25
6
Using R_MakeExternalPtr
Hi all,
I've been writing a package and I've run into a problem that I'm unsure how
to solve. I am looking to pass a C++ class object to R so that it may be
passed back to another C++ function later on to be used. I'm quite new to R
and this is my first time writing a package, so I hope you can bear with me.
The following is how I create the class and use