From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10650a,6a8d05c5cc0286dc X-Google-Attributes: gid10650a,public X-Google-Thread: 1164f8,6a8d05c5cc0286dc X-Google-Attributes: gid1164f8,public X-Google-Thread: f678f,6a8d05c5cc0286dc X-Google-Attributes: gidf678f,public From: Craig Neth USG Subject: Re: A query on shared library in Digital UNIX 4.0 .... Date: 1997/05/07 Message-ID: <3370D06B.41C6@zk3.dec.com>#1/1 X-Deja-AN: 240030404 References: <33575472.33DF@wipsys.stph.net> To: kamal@wipsys.stph.net Organization: Digital UNIX Development Environment Group Newsgroups: comp.sys.dec,comp.unix.internals,comp.unix.osf.misc Kamal Kishore Mantri wrote: > > Hi, > 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. > Kamal, Please take a look at the ld(1) man page, specifically, this section: "Symbol names that start with __init_ and __fini_ have special meaning to the linker. All routines that start with __init_ are treated, by default, as initialization routines. These are routines that are called without an argument when the file that contains them is loaded or when the program that contains them is started. All routines that start with __fini_ are treated by default as termination routines, which are routines that are called without an argument when the file that contains them is unloaded or when the program that contains them exits." This sounds exactly like what you want, yes? If you cannot rename the routines, you may also want to look at the -init and -fini linker options, which let you name symbols that you wish to be treated as init or fini routines. Hope this helps... Craig  ------------------------------------------------------------------------- Craig Neth ! neth@zk3.dec.com DIGITAL Equipment Corporation ! 110 Spit Brook Road ZKO3-3/W17 ! Nashua, NH 03062 ! Opinions expressed herein are my own. ==========================================================================