Displaying 2 results from an estimated 2 matches for "rf_on_exit".
2015 Nov 23
4
Custom C finalizers for .Call
...dure, but these are rare. A lot of C code in packages might
become safer and cleaner if authors would have an option to let this
be automated.
The most general feature would a hook for adding custom C functions to
the .Call exit, similar to on.exit() in R:
xmlNodePtr *node = xmlNewNode(...);
Rf_on_exit(xmlFreeNode, node);
EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(...);
Rf_on_exit(EVP_PKEY_CTX_free, ctx);
SEXP out = PROTECT(allocVector(...));
Rf_on_exit(UNPROTECT, 1);
I don't know R's internals well enough to estimate if something like
this would be possible. I did put together a simpl...
2015 Nov 25
0
Custom C finalizers for .Call
...ode in packages might
> become safer and cleaner if authors would have an option to let this
> be automated.
>
> The most general feature would a hook for adding custom C functions to
> the .Call exit, similar to on.exit() in R:
>
> xmlNodePtr *node = xmlNewNode(...);
> Rf_on_exit(xmlFreeNode, node);
> EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(...);
> Rf_on_exit(EVP_PKEY_CTX_free, ctx);
> SEXP out = PROTECT(allocVector(...));
> Rf_on_exit(UNPROTECT, 1);
>
> I don't know R's internals well enough to estimate if something like
> this would be possi...