Skip to Content.
Sympa Menu

freetds - Re: [freetds] gethostbyname_r fails if statically linked

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] gethostbyname_r fails if statically linked
  • Date: Fri, 10 Mar 2006 09:03:02 +0100

>
> Has anyone one ever tried to statically link a program that
> accesses both MySQL and unixODBC. The reason I ask is that
> the gethostbyname_r function acts strange of seg faults
> when my program is linked statically, dynamically it works

Mmm.... how did you link freetds statically?
gethostname require some additional libraries (like nssswitch) to work,
did you have these libraries and configurations (are you running a
chrooted environment?)

> find, as do the isql and iusql programs. The call to
> gethostbyname_r in question is deep inside freetds in the
> threadsafe.c source. If my program is statically linked it
> always returns NULL, and h_errno is never changed. All

gethostbyname_r is a system function (libc) if it return NULL FreeTDS
fail connection. However it should not seg fault... where does the
program seg fault?

> programs and code are compiled on the system in question
> freetds, unixODBC, and my program. My thinking is that
> somehow the dlopened tds library is somehow accessing a copy
> of gethostbyname_r that is statically linked into my program,
> instead of one that is dynamically available. Maybe somehow
> there are too different libraries with the same function, and
> my program gets a different one (maybe because of MySQL) when
> linked statically.
>

dlopened?? Are you mixing static and dynamic linking together??

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page