search for: dl_func

Displaying 20 results from an estimated 34 matches for "dl_func".

Did you mean: _func
2017 May 09
2
registering Fortran routines in R packages
...rkup&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: static const R_FortranMethodDef FortEntries[] = { {"halton", (DL_FUNC) &F77_NAME(HALTON), 7}, {"sobol", (DL_FUNC) &F77_NAME(SOBOL), 11}, {NULL, NULL, 0} }; But I got error messages when building : use of undeclared identifier ?SOBOL_?. I also tried in lower case sobol and halton. Looking at expm package https://r-forge.r-project.org/scm/viewvc...
2017 May 10
3
registering Fortran routines in R packages
...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 'halton2'? {"halton", (DL_FUNC) &F77_SUB(halton), 7}, My current solution is to comment FortEntries array and use R_useDynamicSymbols(dll, TRUE) for a dynamic search of Fortran routines. Regards, Christophe --------------------------------------- Christophe Dutang LMM, UdM, Le Mans, France web: http://dutangc.free.fr <...
2012 Feb 06
1
Segfault on ".C" registration via R_CMethodDef according to 'Writing R Extensions'.
...irrelevant). According to the manual 'Writing R Extensions' of version 2.14.1 an example is given that specifies to use the fourth field (type information) for definitions of C routines that use the ".C" calling convention: R_CMethodDef cMethods[] = { {"myC", (DL_FUNC) &myC, 4, {REALSXP, INTSXP, STRSXP, LGLSXP}}, /* segfault! */ {NULL, NULL, 0} }; If I follow this example I get compiler warnings or errors (whether I use C or C++, respectively) and a segmentation fault (in the case of C) when doing R CMD INSTALL, which seem to happen during testing....
2017 Dec 29
1
winbuilder warning message wrt function pointers
...nd 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) { fun = R_GetCCallable("bdsmatrix", "bdsmatrix_prod4"); } if (fun==NULL) { Rf_error("Cannot find C function 'bdsmatrix_prod4' in library 'bdsmatrix.{so,dll}'"); } fun(nrow, nblock, bsize, bm...
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
2017 May 09
0
registering Fortran routines in R packages
...> > 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: > > static const R_FortranMethodDef FortEntries[] = { > {"halton", (DL_FUNC) &F77_NAME(HALTON), 7}, > {"sobol", (DL_FUNC) &F77_NAME(SOBOL), 11}, > {NULL, NULL, 0} > }; > > But I got error messages when building : use of undeclared identifier ?SOBOL_?. I also tried in lower case sobol and halton. > > Looking at expm package https:/...
2014 Jan 22
1
Linking to native routines in other packages
...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) { R_RegisterCCallable("stochvol", "sampler", (DL_FUNC) sampler); } in some file within stochvol's 'src' directory, and DL_FUNC stochvol_sampler = R_GetCCallable("stochvol", "sampler"); in some file within the 'src' directoy of the package depending on stochvol. When installing that package, I however get: E...
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 will use R_CallMethodDef callMethods[] = { CALL_DEF(myCall, 3), {NULL, NULL, 0} }; instead...
2017 Dec 29
0
winbuilder warning message wrt function pointers
...rneau at mayo.edu> wrote: > Bill, > That's a very nice solution. It is both cleaner looking and preferable > to track R's .h files. > However, some of my routines don't have void * as the return type (two are > int *), and Rdynload has > > typedef void * (*DL_FUNC)(); > > Will this untruth mess anything up? > > Terry T. > > On 12/29/2017 10:52 AM, William Dunlap wrote: > > 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...
2009 Jan 08
1
Callbacks seems to get GCed.
...nclude <Rinterface.h> SEXP callback1; SEXP callback2; void set_callback1(SEXP func) { PROTECT(callback1 = func); } void set_callback2(SEXP func) { PROTECT(callback2 = func); } R_CMethodDef cMethods[] = { {NULL} }; R_CallMethodDef callMethods[] = { {"set_callback1", (DL_FUNC) &set_callback1, 1}, {"set_callback2", (DL_FUNC) &set_callback2, 1}, {NULL} }; void r_trigger_callback1() { int errorOccurred; SEXP f = NULL; f = allocVector(LANGSXP, 1); SETCAR(f, callback1); PROTECT(f); R_tryEval(f, R_GlobalEnv, &errorOccurred);...
2003 Oct 21
2
Problem R-1.8.0 library tcltk on Tcl-8.0.5 (PR#4699)
...ibs/tcltk.so: undefined symbol: RTcl_ActivateConsoleError in runHook(".onLoad", env, package.lib, package) : .onLoad failed Error in library(tcltk) : package/namespace load failed R-1.8.0/src/library/tcltk/src/init.c 32 #ifndef TCL80 33 {"RTcl_ActivateConsole", (DL_FUNC) &RTcl_ActivateConsole, 0}, 34 #endif TCL80 is not defined anywhere. It is defined only as tcltk.c.
2011 Feb 11
1
Writting my own package - 64 bit problem with R_GetCCallable
...king the pointer sizeof's seems like R_GetCCallable's return should be the same size as the function pointer. -------------- (gdb) p sizeof(void*) $5 = 8 (gdb) p sizeof(CHM_SP*) $6 = 8 (gdb) p sizeof(CHM_SP) $7 = 8 (gdb) p sizeof(SEXP) $8 = 8 (gdb) p sizeof(CHM_SP(*)) $9 = 8 (gdb) p sizeof(DL_FUNC) $10 = 8 (gdb) p sizeof(DL_FUNC*) $11 = 8 -------------- The function is invoked by ---------- fitholder->Zt = R_as_cholmod_sparse ((CHM_SP)malloc(sizeof(cholmod_sparse)), Zt, TRUE, FALSE); ----------- where Zt is a SEXP pointing to a Matrix-class sparse matrix passed by .Call from R. CHM_SP...
2013 Mar 09
5
question on why Rigroup package moved to Archive on CRAN
Hi, Who should I ask about my package Rigroup_0.83 being moved to Archive status on CRAN and no longer available via install.package? I have no problems with the move if this was simply because of low demand. However, if there was a build issue with the newest releases that caused problems, I would be happy to address it. I'll just ask my students to install it from my own locally hosted
2003 May 28
0
R_GlobalEnv
...defineVar(install("Foo"),Value,Rho); return Value; } static SEXP assignValueToFooInR_GlobalEnv(SEXP Value) { defineVar(install("Foo"),Value,R_GlobalEnv); return Value; } static const R_CallMethodDef CallEntries[] = { {"assignValueToFooInRhoEnv", (DL_FUNC)&assignValueToFooInRhoEnv,2}, {"assignValueToFooInR_GlobalEnv", (DL_FUNC)&assignValueToFooInR_GlobalEnv,1}, {NULL,NULL,0} }; void R_init_testR_GlobalEnv(DllInfo *info) { R_registerRoutines(info,NULL,CallEntries,NULL,NULL); } ***** In R ***** > dyn.load("testR_GlobalE...
2007 Jun 01
1
Calling C routine in anther package in C code (R_RegisterCCallable)
...==== #include <R.h> #include <Rinternals.h> #include <R_ext/Rdynload.h> extern "C" { void dummy(int *a, int *b) { printf("dummy\n"); } } void R_init_dummy(DllInfo *dll) { R_RegisterCCallable("dummy", "dummy", (DL_FUNC)dummy); } ====== R/zzz.R ========= .First.lib <- function(lib, pkg) { library.dynam("dummy", pkg, lib) } ====================== I can compile this using R 2.5.0 under Linux. But I got the following error when I tried to load the library >library(dummy):...
2003 May 16
1
Reloading a shared library with dyn.load
...nload.h> #include <R_ext/Memory.h> #include <R_ext/Applic.h> #include <stdio.h> void HelloFromC(char **result) { *result = (char *) R_alloc(20,sizeof(char)); sprintf(*result,"Hello from C!"); } static const R_CMethodDef CEntries[] = { {"HelloFromC",(DL_FUNC) &HelloFromC,1}, {NULL,NULL,0} }; void R_init_HelloFromC(DllInfo *info) { R_registerRoutines(info,CEntries,NULL,NULL,NULL); } ---------------------------------------------------------------- c:\james\HelloFromC> Rcmd SHLIB HelloFromC making HelloFromC.d from HelloFromC.c gcc -IC:/JAM...
2017 May 10
1
registering Fortran routines in R packages
...on2() 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 'halton2'? > {"halton", (DL_FUNC) &F77_SUB(halton), 7}, > > My current solution is to comment FortEntries array and use R_useDynamicSymbols(dll, TRUE) for a dynamic search of Fortran routines. Have a look at my package geigen and its init.c. Could it be that you are missing extern declarations for the Fortran routines?...
1998 May 27
3
dependencies in .so files
Thomas Lumley writes: > > > I've been trying to get Matt Calder's S compiler to work in R using R > COMPILE and R SHLIB so it will be fairly platform-independent. > > I'm sure someone has claimed in the past that it is possible/easy to > dyn.load() two dynamic libraries and have one call functions in the other. > I can't get it to work (Red Hat
2003 Dec 09
1
R Interface handholding
..., by dropping it into a stub directory along with something called init.c: #include "areone.h" #include <R_ext/Rdynload.h> #include <Rinternals.h> R_NativePrimitiveArgType myincr_t[1] = {INTSXP}; static const R_CMethodDef cMethods[] = { {"myincr", (DL_FUNC) &myincr, 1, myincr_t} }; void R_init_myincr(DllInfo* dll) { R_registerRoutines(dll, cMethods, NULL, NULL, NULL); } R is happy to install this for me, but after doing a library(myincr), the function doesn't seem to be available, so I presume I'm missing something. Does R norma...
2007 May 01
1
Embedding R and registering routines
Hello, The use of .Call and the like all depend on loading shared libraries and registering routines from it. Also, .Primitive and .Internal depend on routines being registered in the R binary. And applications that embed R can override routines declared in Rinterfac.h, but is there a way for an application embedding R to register other routines defined in the application without loading a