Hi All.
I tested libpq for win32 coming with 6.4-BETA and have a question about
LIBPQ.
I used LIBPQ from a C program,but coundn't connect PostgreSQL DB.
Calling pg_connect() without WSAStartup() failed because of gethostbyname()
error in LIBPQ.
so I modified DllMain in LIBPQ as follows.
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason,
LPVOID lpReserved ){
WSADATA wsaData;
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
WSAStartup( WSAStartup(MAKEWORD(1, 1), &wsaData);
break;
case DLL_PROCESS_DETACH:
WSACleanup();
break;
}
return (TRUE);
}
and the connection to DB was OK.
Why WSAStartup() is not called in LIBPQ?
Thanks.
Hiroshi Inoue
Inoue@tpf.co.jp