[C++-sig] Re: module unloading callback?
Mike Rovner
mike at nospam.com
Mon Jan 19 22:12:25 CET 2004
Daniel Holth wrote:
> I've been wrapping a library thats documentation says you should
> init() and free() some internal data structures before and after you
> use it. I can put code in BOOST_MODULE_INIT to call init, but where
> would I put the tear-down code? Thanks.
That is very common problem for many libraries. They usually provide
libInit(...)
libFinish(...)
My approach is simply wrap them as (module) lib functions:
Init(...) and Finish(...)
for the user to call manually.
Optionaly as you said, 'init' is called automatically on module init.
That is really depends on library usage model.
But because python _never_ unloads its modules you can't put 'finish'
call anywere to be called automatically.
My $.02
Regards,
Mike
More information about the Cplusplus-sig
mailing list