Subject: Re: C shared lib question
To: Johnny C. Lam <lamj@stat.cmu.edu>
From: Jason R Thorpe <thorpej@shagadelic.org>
List: tech-toolchain
Date: 03/09/2000 11:58:49
On Thu, Mar 09, 2000 at 01:00:56PM -0500, Johnny C. Lam wrote:
> > > BOOL _init (void)
> > > {
> > > getGlobalDefaults(DBMS_NAME, ODBCINST_INI, FALSE);
> > > return TRUE;
> > > }
>
> but when I compile on NetBSD/i386-ELF, I get:
>
> psqlodbc.o: In function `_init':
> psqlodbc.o(.text+0x0): multiple definition of `_init'
> /usr/lib/crtbeginS.o(.init+0x0): first defined here
> /usr/bin/ld: Warning: size of symbol `_init' changed from 48 to 47 in psqlodbc.o
> psqlodbc.o: In function `_fini':
> psqlodbc.o(.text+0x30): multiple definition of `_fini'
> /usr/lib/crtbeginS.o(.fini+0x0): first defined here
> /usr/bin/ld: Warning: size of symbol `_fini' changed from 29 to 10 in psqlodbc.o
> collect2: ld returned 1 exit status
>
> I guess I'm doing something wrong? I'll try the constructor attribute, next.
Well, that is sucky. The linker is supposed to recognize those and stuff
them into the .init and .fini sections.
Maybe they need to have "static" as part of their declarations...
Any linker gurus out there wanna comment on this?
--
-- Jason R. Thorpe <thorpej@shagadelic.org>