I have created a module that wraps a large C library. I need to use object finalizers to run teardown functions from the C library for each Julia object I create that’s holding onto structs from the C library.
I addition: the C library needs a final teardown function called before the program exits. It seems natural to do this in an
atexit() that’s registered in my module’s
atexit() methods are called before finalizers! This leads to a segfault in my module due to the finalizers calling into the torn-down C library.
What’s the right way to handle this in Julia? Am I going to need to have my own “object registry” that I manually go through and
finalize() in my
Thanks for any insights!