Re: [exim-dev] dlopen cleanup

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Tony Finch
Ημερομηνία:  
Προς: David Saez Padros
Υ/ο: exim-dev
Αντικείμενο: Re: [exim-dev] dlopen cleanup
On Tue, 30 May 2006, David Saez Padros wrote:
>
> Just for the whishlist, it may be interesting to implement a
> 'cleanup' routine for dynamically-loaded objects so when exim
> shutdown it will try to call a predefined function in each
> dynamically-loaded object (i.e. exim_dl_cleanup) that gives
> any dynamically-loaded object the chance to do it's own cleanup


This functionality is built-in to the dynamic linker as part of its
support for C++ static constructors and destructors. You can make use of
this functionality with GCC's C extensions by using the destructor
attribute on your cleanup function's declaration. For example:

static void cleanup(void) __attribute__((destructor));

Tony.
--
<fanf@???> <dot@???> http://dotat.at/ ${sg{\N${sg{\
N\}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}\
\N}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}