XS on Win32 hassle

miyagawa on 2004-10-06T07:42:48

I'm working on Apple's Rendezvous Windows SDK port to Perl on win32 using XS. Currently, DNSRegisterService seems to work, but it has a problem with select() which works in usual C program, but breaks in XS module.

Here's a sample C program rendezvous.c that works. It produces an output like:

C:> rendezvous.exe
fd: 1992
got result: 1
Got a reply for Astoria._daap._tcp.local.: Name now registered and active


While simply converted XS module Rendezvous.zip that is broken. It produces:

> perl -Mblib -MRendezvous -w -e "Rendezvous::main()"
fd: 1960
got result: -1
select() returned -1 errno 0 No error


the difference is select() that returns -1 on XS version... I'm afraid it's due to something around win32 libraries like winsock. (I've built both of them using cl.exe which comes from Microsoft .NET Framework SDK, and Microsoft Platform SDK header files)

If you are familiar with Win32 things and take your time to look into the code, it'll be greatly appreciated.


sounds familiar

thinc on 2004-10-06T09:52:10

This sounds familiar to me, but I can't remember the specifics.

Try searching for WSAInit()

Sorry I can't recall any more than that.

Re:sounds familiar

miyagawa on 2004-10-06T11:49:03

Thanks, thinc. I'll search for that. If you come to recall more than that, tell me about it ;)

Re:sounds familiar

miyagawa on 2004-10-06T13:17:09

Adding WSAGetLastError() after select() shows the errorcode is 10038, which means WSAENOTSOCK.It seems like DNSServiceRefSockFD(client) does not return the valid socket?