[Rd] RE: [R] Keeping the data of C structure in R variables?..
reid_huntsinger at merck.com
Fri Feb 4 17:45:58 CET 2005
I think you should have a look at external pointers (type EXTPTRSXP). They
are used in the R source . See, for example, memory.c. Also see the
developer page notes on weak references, finalizers, etc, which you'll need
to be familiar with.
This is really an R-devel question!
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Oleg Sklyar
Sent: Friday, February 04, 2005 11:11 AM
To: R-help at stat.math.ethz.ch
Subject: [R] Keeping the data of C structure in R variables?..
does anybody know if there is a way to implement the following idea:
if for example I have a C/C++ structure of form:
char * data;
in C code I could create some implementation that would create this
structure by pointer and fill in the data, so I would have a variable
Now what I need is to pass this data to a certain SEXP structure and
keep it completely in R, thus setting myData = NULL and _unloading the C
library_; then later I want to create another variable, in another C
call, SData* myOldData and reload it with values from R. Is there a way
to do that, keeping also in mind that char* data is generally binary data.
Would be greatful for any suggestions.
R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide!
More information about the R-devel