[C++-sig] module destructor?

Neal Becker ndbecker2 at gmail.com
Mon Mar 5 14:43:35 CET 2007


Stefan Seefeld wrote:

> 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...
> 

Thanks.  I've never tried to instantiate an object from c++.  Any
examples/hints?





More information about the Cplusplus-sig mailing list