Skip to content
Prev 54502 / 398498 Next

Error messages and C

On Fri, 2004-08-20 at 12:04, Thomas Lumley wrote:
That's not hard in my case, so that's what I'm doing.
That would be tricky, since the location of the objects to be destroyed
is only known inside my original function.  Of course, I could use
global variables...
The weak references cleaned up are R objects, and my stuff is mostly
non-R objects.  I see two possible ways to get this to work:
1) Create some kind of dummy R object with a finalizer that cleans up my
C++ objects.
2) Hook the C++ object creation facilities (via new) into R.
Either approach is complex, possibly not doable, and probably
inefficient.  Fortunately, I don't need this.
If space permits, is this just an ordinary, C-style null terminated
string?  Or does R have some notion of the string length which is
unaffected by what I stuff in it?
So if I overwrite p[0], for example, the R garbage collector will know
to clean up the old string that was pointed to from that location?
Thanks for the info.