[Rd] RE: [R] Keeping the data of C structure in R variables?..

From: Huntsinger, Reid <reid_huntsinger_at_merck.com>
Date: Sat 05 Feb 2005 - 03:45:58 EST

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!

Reid Huntsinger

-----Original Message-----
From: r-help-bounces@stat.math.ethz.ch
[mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Oleg Sklyar Sent: Friday, February 04, 2005 11:11 AM To: R-help@stat.math.ethz.ch
Subject: [R] Keeping the data of C structure in R variables?..

Dear all,

does anybody know if there is a way to implement the following idea:

if for example I have a C/C++ structure of form:

struct {

    int size;
    char * data;
} SData;

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 something like

SData* myData;

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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide!

R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat Feb 05 03:24:14 2005

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:02:44 EST