From: "Berger, Daniel" Date: 2002-06-12T04:14:00+09:00 Subject: RE: hostent extension problem - returning the ip address > -----Original Message----- > From: ts [mailto:decoux@moulon.inra.fr] > Sent: Tuesday, June 11, 2002 11:03 AM > To: ruby-talk@ruby-lang.org > Cc: ruby-talk@ruby-lang.org > Subject: Re: hostent extension problem - returning the ip address > > > >>>>> "B" == Berger, Daniel writes: > > B> Also, the eventual plan is to use the thread-safe versions > provided by > B> individual vendors, e.g. gethostbyname_r() on Solaris. I > thought I would > B> start with a basic version and work my way up from there. :) > > 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't need a Data_Wrap_Struct() > > > Guy Decoux > 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. :( 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. :) Thanks for the help. Dan