search for: r_interface_ptrs

Displaying 6 results from an estimated 6 matches for "r_interface_ptrs".

2007 Apr 03
2
R callbacks
...9;m trying to understand (mostly from the R-exts manual) how to use the callbacks declared in Rinterface.h. As a first attempt, I'm trying to redefine ptr_R_WriteConsole in a very trivial manner. Here's my code: --------------- $ cat altr.c int Rf_initialize_R(int ac, char **av); #define R_INTERFACE_PTRS 1 #include <Rinterface.h> extern int R_running_as_main_program; static void my_R_WriteConsole(char *buf, int len) { printf("R<< %s", buf); } int main(int ac, char **av) { R_running_as_main_program = 1; ptr_R_WriteConsole = my_R_WriteConsole; Rf_initialize_R(...
2007 Jun 28
1
How to set R_CStackLimit
Hi, I have tried to disable stack checking by set R_CStackLimit to -1. However, it always crashes my win32 multiple threads program. I am using R-2.5.0. My code looks like: #include <Rversion.h> #if (R_VERSION >= R_Version(2,3,0)) #define R_INTERFACE_PTRS 1 #define CSTACK_DEFNS 1 #include <Rinterface.h> #endif and then, add below line to my main function: R_CStackLimit = (uintptr_t)-1; //crashes when step to this line. As for input library in link option, I only link to Rdll.lib. Am I missing something? Thanks very much! xzhang...
2009 Dec 26
1
Problem compiling R library on FC4 ( conflicting declaration in Rinterface.h and stdint.h)
.../types.h> #include <sys/time.h> #include <time.h> #include <errno.h> #include <fcntl.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/wait.h> #define R_NO_REMAP #define R_INTERFACE_PTRS 1 #define CSTACK_DEFNS 1 #include <Rversion.h> #include <R.h> #include <Rdefines.h> #include <Rinterface.h> #include <Rembedded.h> #include <R_ext/Boolean.h> #include <R_ext/Parse.h> #include <R_ext/Rdynload.h> Thanks Saptarshi
2009 Jan 08
1
Callbacks seems to get GCed.
...y code to the following sample. Sorry if it is a little verbose. The first couple of call of calls still work, but at some point one of the callbacks (callback1 in my case) changes its type. Regards and thanks for any help, Bernd #include <stdio.h> #include <stdlib.h> #define R_INTERFACE_PTRS 1 #include <Rversion.h> #include <Rembedded.h> #include <Rinternals.h> #include <Rdefines.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...
2008 Jul 18
0
Rcpp from C++
Hi Sri, I haven't really elaborated on it having other stuff to prepare first, but as far as I got you first assign data to a vector: #include <R.h> #include <Rinternals.h> #undef R_INTERFACE_PTRS #include <Rembedded.h> #include "Rcpp.hpp" #include <R_ext/Parse.h> #include <Rinternals.h> #include <Rdefines.h> //assigning a vector SEXP ab; PROTECT(ab = allocVector(REALSXP, 2)); REAL(ab)[0] = 123.45; REAL(ab)[1] = 67.89; UNPROTECT(1);...
2010 Jul 21
1
Plot window does not update in embedded code
...lt; prompt; std::string input; std::cin >> input; for (unsigned int i = 0; i < input.length(); ++i) { buf[i] = input[i]; buf[i+1] = '\n'; buf[i+2] = '\0'; if ((int)i >= buflen-3) break; } return input.length(); } extern "C" { #define R_INTERFACE_PTRS #include <Rinterface.h> int Rf_initialize_R(int ac, char **av); /* in ../unix/system.c */ extern int R_running_as_main_program; /* in ../unix/system.c */ } int main(int ac, char **av) { R_running_as_main_program = 1; Rf_initialize_R(ac, av); ptr_R_WriteConsoleEx = &R_WriteConsole...