[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] Executing code once on initialization of a .so file



On Sat, Dec 06, 2003 at 10:37:57 +0100, Holger Rauch wrote:
> Is it possible to include code in a .so that gets executed only once on
> initialization of a shared lib?

AFAIK yes. The ELF binary format has a ".init" section for that purpose; see
http://citeseer.nj.nec.com/lu95elf.html .

> If so, how can I do this (provided I use "gcc -fPIC" to compile the stuff
> and "gcc -shared" to link it together).

I don't have an example handy, unfortunately.

HTH,
Ray
-- 
Brought to you by Microsoft .NOT technology: just say No.



Reply to: