I was guessing, actually - I knew that didn’t work, I merely put it there as
an “alert” of sorts to point you to the area where I’m having trouble.
Also, the eventual plan is to use the thread-safe versions provided by
individual vendors, e.g. gethostbyname_r() on Solaris. I thought I would
start with a basic version and work my way up from there.
Regards,
Dan
···
-----Original Message-----
From: ts [mailto:decoux@moulon.inra.fr]
Sent: Tuesday, June 11, 2002 10:26 AM
To: ruby-talk@ruby-lang.org
Cc: ruby-talk@ruby-lang.org
Subject: Re: hostent extension problem - returning the ip address
Data_Wrap_Struct(cHost,0,host_free,hp);
[…]
hp = gethostbyname(h);
pptr = hp->h_addr_list;
Data_Wrap_Struct(cHost,0,host_free,pptr); /* problem here? */Why do you use Data_Wrap_Struct() ?
On Solaris 8, for gethostbyname(3)
The functions gethostbyname(), gethostbyaddr(), and gethos- tent() use static storage that is reused in each call, mak- ^^^^^^^^^^^^^^ ing these functions unsafe for use in multi-threaded appli- cations.
Guy Decoux