Status of hstrerror() and h_errno in cygwin and one more important question

Eric Lilja mindcooler@gmail.com
Mon Apr 9 21:36:00 GMT 2007


Hello!

I'm developing a very simple IRC bot (written in C++) with a gui using 
the cygwin tools. I use Win32 for the gui and I use cygwin sockets and 
pthreads for communicating with the server.

Anyway, I found h_errno/hstrerror() to be useful when dealing with 
gethostname() errors, but they are marked as obsolete in linux, I think, 
meaning they could be removed in the future I guess...what is the status 
for those in cygwin? Is there an alternative I can use right now? I like 
my socket code to be as portable to a modern linux as possible.

Also, and more importantly, I'm having a weird core dump in my 
application. The program is very simple, when launched you can connect 
to an irc server (which one is hard coded right now). A new thread is 
spawned upon connection that handles all communication with the irc 
server, any messages are displayed in the gui. When you are connected 
you may disconnect and connect again if you wish. The threading part is 
encapsulated in a class that contains another class that encapsulates 
the socket code. This thread class dynamically allocated. The core dump 
happens when these things are true:
You connect
You stay connected long enough to receive the entire MOTD.
You disconnect.
You exit the program, main thread calls delete on the thread class 
object <--- core dump here.

If you disconnect earlier or exit without first explicitly 
disconnecting, it does not core dump. Also, it does not core dump if you 
skip the delete. Since the program is exiting its memory is bound to be 
returned anyway, but this still annoys me to no end. I just wrote a 
console version which I thought I could use as a simpler test case but 
that version does not core dump, heh.

Afaics, cygwin doesn't have a mailing list for those developing their 
own programs under cygwin and need support. Do you have any idea where I 
can turn for help and maybe some suggestions on how I can obtain more 
information about exactly why it craps out? My gdb skills are abysmal, 
I'm afraid. I'm decent with the visual studio debugger but I just can't 
seem to get efficient with gdb. Even the simplest things like keeping 
track of exactly which line I am at in the code deludes me. And that's 
even with running emacs' gdb mode!

- Eric


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list