Skip to content

Global Resources Cleanup #685

Answered by dbasgoeze
dbasgoeze asked this question in Q&A
Discussion options

You must be logged in to vote

I've found an answer in pybind11`s documentation:

One can use the atexit module like this:

auto atexit = nanobind::module_::import_("atexit");
atexit.attr("register")(nanobind::cpp_function([](){
      // cleanup here
    }));

I think that solves my question.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dbasgoeze
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant