On Tue, Jul 10, 2001 at 07:24:05PM -0400, Timothy H. Keitt
wrote:> I see some code in R to attach finalizers to external pointer references
> (Register[C]Finalizer). Anyone have an example of how to code the
> finalizer? R_RegisterCFinalizer accepts a C function, but I can't see
> how to get it to operate on the pointer, since the pointer is not passed
> to the function when its called. RegisterFinalizer takes an R closure,
> but how is it called from R (tried .Internal)?
>
> Tim
>
> --
> Timothy H. Keitt
> Department of Ecology and Evolution
> State University of New York at Stony Brook
> Stony Brook, New York 11794 USA
> Phone: 631-632-1101, FAX: 631-632-7626
> http://life.bio.sunysb.edu/ee/keitt/
>
There is a writeup on this, including some example code, in
http://www.stat.umn.edu/~luke/R/simpleref.html
(also available off http://developer.r-project.org/). For the C
finalizer, the C function you register is of type R_CFinalizer_t,
defined as
typedef void (*R_CFinalizer_t)(SEXP);
The SEXP it is called with is the external pointer object.
luke
--
Luke Tierney
University of Minnesota Phone: 612-625-7843
School of Statistics Fax: 612-624-8868
313 Ford Hall, 224 Church St. S.E. email: luke@stat.umn.edu
Minneapolis, MN 55455 USA WWW: http://www.stat.umn.edu
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To:
r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._