TOPIC: dll function not working
dll function not working 1 Year, 1 Month ago
I use the Windows API function gethostbyname to check if a domain does exist.
Suddenly this did not work anymore. I spent some time narrowing it down, but still have not found the exact cause for it.
I got sofar:

Suneido w/o the Users Manual opened at startup, in WorkSpace:


f = dll long Ws2_32:gethostbyname([in] string name)

Execute it and it will return 0 (not found).

Open the Users Manual by menu or

BookControl("suneidoc", "User's Manual", help_book:)

It can be closed again right away.
And surprise: the previous two lines now do work!

Tested it on 3 PCs (XP and Vista), all with the same results.

Any idea?

Thanks in advance,

Jos Schaars
Re:dll function not working 1 Year, 1 Month ago
Seems like BookControl is doing some kind of initialization.

I tried AtlAxWinInit (called by BrowserControl) but that did not help.

Then I noticed the function is in the WinSock 2 dll. This usually requires calling WSAStartup first.

The exe calls WSAStartup when you run a SocketClient or SocketServer.

If I run HttpServer() then gethostbyname works.

It also works if you call it from Suneido:

WSAStartup(MAKEWORD(2,2), Object()) // returns 0 if successful

Something in the book system must be calling WSAStartup.
Last Edit: 2009/06/24 22:52 By andrew.
Re:dll function not working 1 Year, 1 Month ago
Hi Andrew,

WSAStartup did the trick, Thanks
Re:dll function not working 1 Year, 1 Month ago
No problem, good to hear from you.