Title: C Resource Cleanup via Exit Handlers
Version: 0.1.4
Description: Wrapper of .Call() that runs exit handlers to clean up C resources. Helps managing C (non-R) resources while using the R API.
License: MIT + file LICENSE
URL: https://r-lib.github.io/cleancall/, https://github.com/r-lib/cleancall
BugReports: https://github.com/r-lib/cleancall/issues
Depends: R (≥ 3.6)
Suggests: covr, testthat (≥ 3.0.0)
Config/Needs/website: tidyverse/tidytemplate
Config/testthat/edition: 3
Encoding: UTF-8
RoxygenNote: 7.2.3
NeedsCompilation: yes
Packaged: 2026-04-08 07:23:20 UTC; gaborcsardi
Author: Lionel Henry [aut], Gábor Csárdi ORCID iD [aut, cre], Posit Software, PBC [cph, fnd]
Maintainer: Gábor Csárdi <csardi.gabor@gmail.com>
Repository: CRAN
Date/Publication: 2026-04-08 07:50:02 UTC

cleancall: C Resource Cleanup via Exit Handlers

Description

Wrapper of .Call() that runs exit handlers to clean up C resources. Helps managing C (non-R) resources while using the R API.

Author(s)

Maintainer: Gábor Csárdi csardi.gabor@gmail.com (ORCID)

Authors:

Other contributors:

See Also

Useful links:


Call a native routine within an exit context

Description

C functions called this way can call the r_call_on_exit() and/or r_call_on_early_exit() functions to establish exit handlers.

Usage

call_with_cleanup(ptr, ...)

Arguments

ptr

A native pointer object.

...

Arguments for the native routine.

Handlers installed via r_call_on_exit() are always executed on exit. Handlers installed via r_call_on_early_exit() are only executed on early exit, i.e. not on normal termination.

C API

See Also

The package README file.