Displaying 7 results from an estimated 7 matches for "r_nativeprimitiveargtype".
2012 Feb 06
1
Segfault on ".C" registration via R_CMethodDef according to 'Writing R Extensions'.
...}', I get the following error:
*** arch - i386
g++ -arch i386 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -fPIC -g -O2 -c reg.cpp -o reg.o
reg.cpp:30: error: braces around scalar initializer for type ???R_NativePrimitiveArgType*???
(line 24 is the point on the entry, while line 30 is the end of the overall array initialization list in C++).
If I put the type and style (unsigned int and enum) arrays separately,
the build process works just fine. E.g.
R_NativePrimitiveArgType types[] = {REALSXP, INTSXP, STRSXP, LGLSXP};...
2007 Apr 04
1
Accessing C++ code from R
...gth"
passed 4 arguments, but takes just 1
/usr/include/c++/4.0.0/bits/codecvt.h:216: error: expected ';' 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,...
2003 Dec 09
1
R Interface handholding
...;
PROTECT(returner = NEW_INTEGER(input));
Rprintf("Hey there\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 libr...
2024 May 28
1
How to call directly "dotTcl" C-function of the tcltk-package from the C-code of an external package?
...directly was using the following C-level
approach in which essential parts of the headers are copied from the Rdynpriv.h:
#include <R.h>
#include <Rinternals.h>
#include <R_ext/Rdynload.h>
typedef struct {
char *name;
DL_FUNC fun;
int numArgs;
R_NativePrimitiveArgType *types;
} Rf_DotCSymbol;
typedef Rf_DotCSymbol Rf_DotFortranSymbol;
typedef struct {
char *name;
DL_FUNC fun;
int numArgs;
} Rf_DotCallSymbol;
typedef Rf_DotCallSymbol Rf_DotExternalSymbol;
struct Rf_RegisteredNativeSymbol {
NativeSymbolType type;
union...
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 crash the latter if the package registers routines to be
called from .C or .Fortran:
% R-3.3.3 --quiet
> library(sp, lib.loc=c("/...
2005 May 12
0
Patch to address (PR#7853) -- tested briefly, seems to
...+ for (i = 0; i < n; i++)
> + rawptr[i] = RAW(s)[i];
> + }
> + return (void *) rawptr;
> + break;
> case LGLSXP:
> case INTSXP:
> n = LENGTH(s);
> @@ -329,6 +340,7 @@
>
> static SEXP CPtrToRObj(void *p, SEXP arg, int Fort,
> R_NativePrimitiveArgType type)
> {
> + unsigned char *rawptr;
> int *iptr, n=length(arg);
> float *sptr;
> double *rptr;
> @@ -339,6 +351,12 @@
> SEXP s, t;
>
> switch(type) {
> + case RAWSXP:
> + s = allocVector(type, n);
> + rawptr = (unsigned char *)p;...
2024 May 30
1
How to call directly "dotTcl" C-function of the tcltk-package from the C-code of an external package?
...in which essential parts of the headers are copied from the Rdynpriv.h:
>
> #include <R.h>
> #include <Rinternals.h>
> #include <R_ext/Rdynload.h>
>
> typedef struct {
> char *name;
> DL_FUNC fun;
> int numArgs;
>
> R_NativePrimitiveArgType *types;
> } Rf_DotCSymbol;
>
> typedef Rf_DotCSymbol Rf_DotFortranSymbol;
>
> typedef struct {
> char *name;
> DL_FUNC fun;
> int numArgs;
> } Rf_DotCallSymbol;
>
> typedef Rf_DotCallSymbol Rf_DotExternalSymbol;
>
> struct Rf_...