On 05/07/2009 6:05 PM, Yuri D'Elia wrote:
In article <4a5102ff.8040...@stats.uwo.ca>,
Duncan Murdoch <murd...@stats.uwo.ca> wrote:
What I'd would like to do is:
- "patch" the SEXP returned to R so that DATAPTR() points directly to
the required address.
The normal way to do what you want is to use an "external pointer". R
assumes that memory management for those is handled completely
externally. External pointers can have finalizers, so when you no
longer have a need for the object, you can ask the external library to
release it.
I don't think external pointers can be read from R sources like normal
vectors, or am I wrong?
No, you're right.
Using external pointers would imply either proxy calls for every action
you need to perform or deep copies (like I'm doing now).
Yes.
Duncan Murdoch
I wouldn't try to trick the memory manager into thinking that it
allocated these things; that will likely just lead to problems.
I'm not afraid of patching R sources somehow, if that's the only
solution, but it's one that I would like to avoid.
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel