[C++-sig] module destructor?

Stefan Seefeld seefeld at sympatico.ca
Mon Mar 5 14:29:36 CET 2007


Neal Becker wrote:
> It is easy to put some code to run when a module is loaded:
> 
> BOOST_PYTHON_MODULE(foo) {
>   do_some_init();
> ...
> 
> But how can I do some cleanup when module is unloaded?

Export a 'cleanup' type and instantiate it as a 'global object'
in your module. If nothing else is referring to it it will be
deleted with the module...

HTH,
		Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the Cplusplus-sig mailing list