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

Oleg Sklyar osklyar at ebi.ac.uk
Fri Feb 4 17:10:45 CET 2005


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.

Regards
Oleg




More information about the R-help mailing list