Hostent extension problem - returning the ip address

Various attempts at this suggestion (prior to posting) failed. Now,
however, it seems to work fine. Looking back, I think I was freeing memory
before I was finished with it. :frowning:

I also need to have my eyes examined again. I had rb_block_given() instead
of rb_block_given_p(). This caused in ld error when I would run it, which
led me to believe I had a memory issue somewhere - until I looked at the
error message more closely. :slight_smile:

Thanks for the help.



-----Original Message-----
From: ts []
Sent: Tuesday, June 11, 2002 11:03 AM
Subject: Re: hostent extension problem - returning the ip address

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. :slight_smile:

Well, even if you use gethostname_r() you must first
allocate the struct
and the buffer. You call gethostname_r(), create the result
(rb_str_new2()), free the struct and buffer and return the
result or call
rb_yield(). You don鈥檛 need a Data_Wrap_Struct()

Guy Decoux