This is the mail archive of the glibc-linux@ricardo.ecn.wfu.edu mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: shared lib exit function


> #define __exit __attribute__ ((__section__ (".fini")))
> 
> static void __exit exitfunc(void)
> {
>     if (capi_fd >= 0) {
>        close(capi_fd);
>        capi_fd = -1;
>     }
> }

Hi Carsten,

Did you try

static void exitfunc(void) __attribute__((destructor));

static void exitfunc(void)
{
    if (capi_fd >= 0) {
       close(capi_fd);
       capi_fd = -1;
    }
}

Hope this helps,
Martin

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]