diff --git a/pysrc/juliacall/__init__.py b/pysrc/juliacall/__init__.py index 66bc34e5..6694298e 100644 --- a/pysrc/juliacall/__init__.py +++ b/pysrc/juliacall/__init__.py @@ -3,6 +3,8 @@ __version__ = '0.9.20' +import atexit + _newmodule = None def newmodule(name): @@ -199,6 +201,13 @@ def args_from_config(): None if sysimg is None else sysimg.encode('utf8'), ) + @atexit.register + def at_jl_exit(): + jl_atexit_hook = lib.jl_atexit_hook + jl_atexit_hook.argtypes = [c.c_int] + jl_atexit_hook.restype = None + jl_atexit_hook(0) + # initialise PythonCall jl_eval = lib.jl_eval_string jl_eval.argtypes = [c.c_char_p]