bug-gnu-utils
[Top][All Lists]
Advanced

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

RE: undefined symbol __dso_handle


From: Alejandro Dobniewski
Subject: RE: undefined symbol __dso_handle
Date: Tue, 14 Jan 2003 16:49:55 -0300

I can do that for testing purposes, but we need them for production
releases. These are valid to override according to the program library
how-to:

"5.2. Special functions _init and _fini
Two special functions aid in initializing and finalizing a module: _init and
_fini. If a function ``_init'' is exported in a library, then it is called
when the library is first opened (via dlopen() or simply as a shared
library). In a C program, this just means that you defined some function
named _init. There is a corresponding function called _fini, which is called
whenever a client finishes using the library (via a call dlclose() that
brings its reference count to zero, or on normal exit of the program). The C
prototypes for these functions are:

  void _init(void);
  void _fini(void);

When compiling the file into a ``.o'' file in gcc, be sure to add the gcc
option ``-nostartfiles''. This keeps the C compiler from linking the system
startup libraries against the .so file. Otherwise, you'll get a
``multiple-definition'' error. My thanks to Jim Mischel and Tim Gentry for
their suggestion to add this discussion of _init and _fini, as well as help
in creating it."

-----Mensaje original-----
De: H. J. Lu [mailto:address@hidden
Enviado el: Martes, 14 de Enero de 2003 14:31
Para: Alejandro Dobniewski
CC: 'address@hidden'
Asunto: Re: undefined symbol __dso_handle


On Tue, Jan 14, 2003 at 11:20:54AM -0300, Alejandro Dobniewski wrote:
> I changed to $(CC) -shared -nostartfiles, but if I take out the
> -nostartfiles flag I got this error:
> libbobutil.o: In function `_init':
> /home/adobni/boblin/libbobutil.c:8: multiple definition of `_init'
> /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../crti.o:/tmp/ccnhFcil.s:28:
> first defined here
> libbobutil.o: In function `_fini':
> /home/adobni/boblin/libbobutil.c:14: multiple definition of `_fini'
> /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../crti.o:/tmp/ccnhFcil.s:28:
> first defined here
> collect2: ld returned 1 exit status
> make: *** [libbob.so] Error 1 
> 

Don't define _init/_fini in your code.


H.J.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]