From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,6a8d05c5cc0286dc X-Google-Attributes: gid1164f8,public X-Google-Thread: f678f,6a8d05c5cc0286dc X-Google-Attributes: gidf678f,public X-Google-Thread: 10650a,6a8d05c5cc0286dc X-Google-Attributes: gid10650a,public From: Dave Butenhof Subject: Re: A query on shared library in Digital UNIX 4.0 .... Date: 1997/04/21 Message-ID: <335B5350.58E@zko.dec.com>#1/1 X-Deja-AN: 236337638 References: <33575472.33DF@wipsys.stph.net> Organization: Digital Equipment Corporation Newsgroups: comp.sys.dec,comp.unix.internals,comp.unix.osf.misc Kamal Kishore Mantri wrote: > > I want to intialize some global data & acquire few > system resources(mutexes, shared memory .. etc) when shared > library is loaded. Similiarly these resouces need to released > when shared library is unloaded. Can anybody suggest me a way > of doing this in Digital UNIX 4.0. In HP-UX , it could have > been done with +I_INITIALIZER flag in ld. Two ways: 1) Create a routine with the name __init_[anything], for example, __init_mylib. The loader will call all routines with this format when the library is loaded. Similarly, __fini_[anything] routines are called before the library is unloaded. 2) Use the ld options -init and -fini to cause specific functions to be called at load and unload time. /---[ Dave Butenhof ]-----------------------[ butenhof@zko.dec.com ]---\ | Digital Equipment Corporation 110 Spit Brook Rd ZKO2-3/Q18 | | 603.881.2218, FAX 603.881.0120 Nashua NH 03062-2698 | \-----------------[ Better Living Through Concurrency ]----------------/