[R] How to grow an R object from C (.Call Interface)

Jens Oehlschlägel joehl at gmx.de
Fri Oct 31 13:57:52 CET 2003


What is the best way to grow an R return object in writing a C function
using the Rdefines.h macros.
In my application, the final size of the return object is not known during
construction. My understanding is that each time I grow an R object I have to
use PROTECT() again, probably before UNPROTECTing the smaller version.
However, due to the stack character of the PROTECT mechanism, UNPROTECT would not
work to remove the smaller one, after the bigger has been protected. Is this
an indication to use UNPROTECT_PTR ? Or is another approach recommended?

May be the solution to this is worth a sentence in "Wrtiting R Extensions".

Thanks for any help


Jens Oehlschlägel

-- 
NEU FÜR ALLE - GMX MediaCenter - für Fotos, Musik, Dateien...
Fotoalbum, File Sharing, MMS, Multimedia-Gruß, GMX FotoService

Jetzt kostenlos anmelden unter http://www.gmx.net

+++ GMX - die erste Adresse für Mail, Message, More! +++




More information about the R-help mailing list