search for: cmethods

Displaying 7 results from an estimated 7 matches for "cmethods".

Did you mean: methods
2012 Feb 06
1
Segfault on ".C" registration via R_CMethodDef according to 'Writing R Extensions'.
...he other for the style (in, out, inout or 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 INST...
2003 Dec 09
1
R Interface handholding
...return returner; } I've made this into a package, 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,...
2007 Mar 19
3
Rinternals.h and undefined symbols
Hi, I'm trying to register my native routines using R_registerRoutines (...). I can compile the code, but the loader cannot resolve the symbol: undefined symbol: _Z18R_registerRoutinesP8_DllInfoPK12R_CMethodDefPK15R_CallMethodDefS3_S6 _ $ nm bgx.Rcheck/bgx/libs/bgx.so | grep R_registerRoutines U _Z18R_registerRoutinesP8_DllInfoPK12R_CMethodDefPK15R_CallMethodDefS3_S6
2009 Jan 08
1
Callbacks seems to get GCed.
...de <R_ext/Parse.h> #include <R_ext/Rdynload.h> #include <R_ext/RStartup.h> #include <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);...
2018 Feb 16
0
Competing risks - calibration curve
Hi, Sorry not to provide R-code in my previous mail. R code is below #install.packages("rms") require(rms) #install.packages("mstate") library(mstate) require(splines) library(ggplot2) library(survival) library(splines) #install.packages("survsim") require(survsim) set.seed(10) df<-crisk.sim(n=500, foltime=10, dist.ev=rep("lnorm",2),
2007 Apr 04
1
Accessing C++ code from R
...39; before 'const' /usr/include/c++/4.0.0/bits/codecvt.h:220: error: expected `;' before 'int' main.cpp:51: error: brace-enclosed initializer used to initialize 'R_NativePrimitiveArgType*' Line 51 refers to the standard part to register the function in R: R_CMethodDef cMethods[] = { {"runSimulation", (void* (*) ()) &runSimulation, 27, {INTSXP, INTSXP, INTSXP, REALSXP, REALSXP, REALSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, REALSXP, REALSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, REALSXP, REALSXP, REALSXP}...
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