Displaying 13 results from an estimated 13 matches for "r_cmethoddef".
2017 Apr 25
0
R_CMethodDef incompatibility (affects R_registerRoutines)
I recently noticed a change between R-3.3.3 and R-3.4.0 in the definition
of the R_CMethodDef struct.
typedef struct {
const char *name;
DL_FUNC fun;
int numArgs;
-
R_NativePrimitiveArgType *types;
- R_NativeArgStyle *styles;
-
} R_CMethodDef;
I suspect this is the reason that packages installed by R-3.4.0 and loaded
into R-3.3.3 will cra...
2012 Feb 06
1
Segfault on ".C" registration via R_CMethodDef according to 'Writing R Extensions'.
...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 for type specification and the 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 in...
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
_
Why does it have this funny name? If I look at libR.so, I get an
ordinary symbol name:
$ nm ~/lib64/R/lib/libR....
2004 Jun 22
2
function not in load table
...ynam("izbi", package = pkgname, lib.loc = libname)
data(COLS, package=pkgname)
data(ROWS, package=pkgname)
if (exists(".Dyn.libs")) remove(".Dyn.libs")
if (interactive() && getenv("DISPLAY") != "") x11()
}
I read something about R_CMethodDef in "Writing R Extensions" but I'm
not really sure where I should write it, may in the .First.lib.R or in a
separate file?
Any other possible mistakes?
We are using R 1.9.0 on Fedora Linux.
Thanks a lot, Toralf
2003 May 16
1
Reloading a shared library with dyn.load
...#include <Rinternals.h>
#include <R_ext/Rdynload.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
maki...
2007 Apr 04
1
Accessing C++ code from R
...cted ';' 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,...
2003 Dec 09
1
R Interface handholding
...re\n");
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 av...
2009 Jan 08
1
Callbacks seems to get GCed.
....h>
#include <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(LAN...
2011 Jul 19
1
Measuring and comparing .C and .Call overhead
...ated calls to a C/C++ function from R, and when performance is important
to us, .Call is much preferred to .C, even at modest data sizes.
4- Overhead for .C scales sub-linearly with data size. I imagine that this
overhead can be reduced through registering the functions and using the
style field in R_CMethodDef to optimize data transfer (per Section 5.4 of
"Writing R Extensions"), but perhaps not by more than a half.
5- Even using .Call, the overhead is still a significant percentage of total
time, though the contribution decreases with data size (and compute load of
function). However, in the c...
2017 Mar 06
0
R 3.3.3 is released
....
UTILITIES:
* Environmental variable _R_CHECK_TESTS_NLINES_ controls how R CMD
check reports failing tests (see SS8 of the 'R Internals' manual).
DEPRECATED AND DEFUNCT:
* (C-level Native routine registration.) The undocumented styles
field of the components of R_CMethodDef and R_FortranMethodDef is
deprecated.
BUG FIXES:
* vapply(x, *) now works with long vectors x. (PR#17174)
* isS3method("is.na.data.frame") and similar are correct now.
(PR#17171)
* grepRaw(<long>, <short>, fixed = TRUE) now works, thanks to a...
2017 Mar 06
0
R 3.3.3 is released
....
UTILITIES:
* Environmental variable _R_CHECK_TESTS_NLINES_ controls how R CMD
check reports failing tests (see SS8 of the 'R Internals' manual).
DEPRECATED AND DEFUNCT:
* (C-level Native routine registration.) The undocumented styles
field of the components of R_CMethodDef and R_FortranMethodDef is
deprecated.
BUG FIXES:
* vapply(x, *) now works with long vectors x. (PR#17174)
* isS3method("is.na.data.frame") and similar are correct now.
(PR#17171)
* grepRaw(<long>, <short>, fixed = TRUE) now works, thanks to a...
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
2010 Mar 14
1
Segfault Problem c++ R interface (detailed)
...utines into the R libraries):
#include <R.h>
#include <Rinternals.h>
#include <R_ext/Rdynload.h>
void RSymbReg(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP,
SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
static R_FortranMethodDef FortEntries[] = {
{NULL, NULL, 0}
};
static R_CMethodDef cEntries[] = {
{NULL, NULL, 0, NULL}
};
static R_CallMethodDef callEntries[] = {
{"RSymbReg", (DL_FUNC) &RSymbReg, 14},
{NULL, NULL, 0}
};
void R_init_testing(DllInfo *info) {
R_registerRoutines(info, cEntries, callEntries, FortEntries, NULL);
}
void R_unload_testing(DllInf...