similar to: Handling R Objects in C++

Displaying 20 results from an estimated 10000 matches similar to: "Handling R Objects in C++"

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
2012 May 07
0
R CMD check, interfacing c++ linking errors
Hi there, I am trying to interface c++ code in R and make a package. With R CMD SHLIB the dll was created, but when I try R CMD check, I am getting 'undefined reference to..' linkage error messages. The relevant c++ source from conf-infomap.cpp: #include "conf-infomap.h" #include "R.h" // R functions #include "Rinternals.h" #include "Rmath.h" //
2012 May 08
0
R CMD check, c++ source linking errors
Hi there, I'm sorry if I a send it for second time, I've just subscribed for the list. I am trying to interface c++ code in R and make a package. With R CMD SHLIB the dll was created, but when I try R CMD check, I am getting 'undefined reference to..' linkage error messages. The relevant c++ source from conf-infomap.cpp: #include "conf-infomap.h" #include
2001 Sep 10
1
problems linking c++ code
I've been trying to learn about dynamically loading subroutines in R. Ultimately I would like to use this approach to implement some simulations. For the moment though, I've run into a problem compiling c++ code and loading it into R. The 'C/C++' and 'R'code below works fine when compiled and linked with gcc, but gives an error when the library is compiled and linked with
2010 Mar 14
1
Segfault Problem c++ R interface (detailed)
Hello R Community, I've been working on a project that uses pre-made C++ libraries (using STL) in R and build a package. However, I've been getting an unusual segfault that I'm unable to trace its origin. After many attempts of debugging using gdb, commenting out parts (or all of my code) and valgrind, I'm unable to make heads or tails about what I'm doing wrong. In fact, when
2012 May 08
1
R CMD check linking errors, when interfacing c++
Hi there, I am trying to interface c++ code in R and make a package. With R CMD SHLIB the dll was created, but when I try R CMD check, I am getting 'undefined reference to..' linkage error messages. The relevant c++ source from conf-infomap.cpp: #include "conf-infomap.h" #include "R.h" // R functions #include "Rinternals.h" #include "Rmath.h" //
2013 May 24
1
Problem with Rboolean in c++ code
I am trying to use R_RegisterCFinalizerEx to ensure some c++ object is properly deleted after use. However, I run into some problems when trying to pass in the third argument which is an Rboolean. The line 'R_RegisterCFinalizerEx(p, finalizer, TRUE);' generates the following error when trying to compile using R CMD SHLIB: g++ -I/usr/share/R/include -DNDEBUG -fpic -O2 -pipe
2023 Aug 30
1
Problems with installing R packages from source and running C++ in R, even on fresh R installation
On Wed, 30 Aug 2023 16:31:20 +0000 Christophe Bousquet <chr_bousquet at protonmail.com> wrote: > So, yes, it seems possible for R to localize paths related to > Rtools... But then, I really do not get where things go wrong... When installing packages containing code to compile, R eventually calls R CMD SHLIB. Same thing happens with inline C++: it gets stored in a temporary file,
2012 Jun 21
2
debug R objects at C level
Dear R-devel, I am now at a debugging phase, and would like to inspect the (individual) values in an arbitrary R vector. It should be simple, but after hours of reading I am simply unable to find the right information. A possible C code is: ????????????????? # include <R.h> # include <Rinternals.h> # include <R_ext/Rdynload.h> SEXP foo(SEXP x) // where x is a vector passed by
2009 Nov 18
1
R_NilValue and segfault.
Hello. I've been trying to wrap up the R_NilValue into OCaml-R. I nevertheless get a segfault. As I gathered, R_NilValue is declared in Rinternals.h: > /* Special Values */ > LibExtern SEXP R_NilValue; /* The nil object */ > LibExtern SEXP R_UnboundValue; /* Unbound marker */ > LibExtern SEXP R_MissingArg; /* Missing argument marker */ So, in my r_data.c
2008 Mar 15
1
Experimental R_has_slot() utility
Dear list, The utility "R_has_slot" mentioned in the file NEWS ("Experimental R_has_slot() utility supplementing R_do_slot()") appears to be missing from a fresh checkout of the development branch. $ svn up At revision 44759. $ grep -i has_slot `find include -name '*.h'` $ grep -i _slot `find include -name '*.h'` include/Rdefines.h:#define GET_SLOT(x, what)
2005 Oct 31
1
R-functions in C-Code
Dear R users, I would like to use several R functions from a C-code and I have read the "Introduction to the .C Interface to R". Unfortunately, my shared library with the C-code works only in cases where I use R-routines that are defined Rmath.h, eg. ************************************* less test.c: #include <R.h> #include <Rinternals.h> #include <Rmath.h> void
2005 Apr 27
2
Problems compiling C code on windows
Hi all, I can't get my C routines running on a windows box. I have no problems at all in Linux. On windows, I have installed cygwin and the compilation works well but once I execute "dyn.load(.)" it hangs whatever I use C/C++ interfaces. In Linux it works wonderful but I need to get this code running on windows boxes. I know that the problem should be something with the
2016 Jan 10
3
coerce SEXP type to C++ matrix class and back
Dear all, I am testing a simple C++ function that takes a double matrix as argument and which uses routines provided by the C++ Armadillo package. I am aware of the nice capabilities of Rcpp and RcppArmadillo which helps simplifying a lot and that I have already successfully tested. However, I had a hard time trying to figure out how the coercion from a REALSPX matrix to an arma::mat =
2011 Jan 26
2
Dealing with R list objects in C/C++
Hi, I'd like to construct an R list object in C++, fill it with relevant data, and pass it to an R function which will return a different list object back. I have browsed through all the R manuals, and examples under tests/Embedding, but can't figure out the correct way. Below is my code snippet: #include <Rinternals.h> // Rf_initEmbeddedR and other setups already performed
2005 Jan 24
4
converting R objects to C types in .Call
Dear People, I'm trying to write an R wrapper for a C++ library, using .Call. I've never used .Call before. I'm currently having some difficulties converting a R character string to a C one. Here is a little test program. #include <R.h> #include <Rinternals.h> #include <stdio.h> SEXP testfn(SEXP chstr) { char * charptr = CHAR(chstr); printf("%s",
2023 Aug 30
1
Problems with installing R packages from source and running C++ in R, even on fresh R installation
TL:DR there are at least three maybe four ways to address this depending on what you plan to do. I usually adjust PATH to add Rtools using .Rprofile. But if you do that then if you want to use the command line to invoke R then you need to set the PATH separately when you start the shell. For this reason some people like to set it in the User Environment Variables control panel... but some Rtools
2005 Oct 03
1
storage.mode, C data types and speed
Hi, I am trying to speed up part of an algorithm in which certain columns of a large matrix (X) are replaced by the element-wise product of a matrix (M) and a vector (v). In R, the code might be X[, ind] <- M * v I have written a small C routine to do this for me, but the timing depends on how I define the storage.mode of the objects in R and the data types in C, in a way which I don't
1999 Nov 13
0
patches for alpha
Recently I reviewed my RPM spec files for DU 4.0, and noticed that I forgot to post some problems + patches: 1. ./configure fails to choose a PIC flag, I simply removed the AC_MSG_ERROR and it works. There is actually no PIC flag for DEC cc (with DU 4.0E) --- ./configure.in.alpha-patch Mon Aug 23 06:36:28 1999 +++ ./configure.in Sun Sep 12 17:38:27 1999 @@ -541,7 +541,9 @@
2023 Aug 31
1
Problems with installing R packages from source and running C++ in R, even on fresh R installation
> When installing packages containing code to compile, R eventually calls > R CMD SHLIB. Same thing happens with inline C++: it gets stored in a > temporary file, compiled into a *.dll using R CMD SHLIB and then loaded > using dyn.load(). > > Write the following into a file named hello.c: > > #include <R.h> > #include <Rinternals.h> > SEXP hello(void) {