mirror of
https://github.com/postgres/postgres.git
synced 2025-08-19 23:22:23 +03:00
Here are two new patches for the Win32 support. 1) The patch based on the one from Hiroshi Inoue [Inoue@tpf.co.jp], to load Winsock.dll from libpq.dll. 2) A patch for psql.c to remove the call to WSAStartup(), since it is not required when it's done in libpq.dll. I'm still looking for the possibility of having a crypt() function in libpq.dll too, the same way getopt was included. Any chance of getting this before 6.4, or should we wait for the next one? //Magnus
26 lines
476 B
C
26 lines
476 B
C
#define WIN32_LEAN_AND_MEAN
|
|
#include <windows.h>
|
|
#include <winsock.h>
|
|
|
|
BOOL WINAPI
|
|
DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
|
|
LPVOID lpReserved)
|
|
{
|
|
WSADATA wsaData;
|
|
switch (fdwReason) {
|
|
case DLL_PROCESS_ATTACH:
|
|
if (WSAStartup(MAKEWORD(1,1),&wsaData))
|
|
{
|
|
/* No really good way to do error handling here,
|
|
* since we don't know how we were loaded */
|
|
return FALSE;
|
|
}
|
|
break;
|
|
case DLL_PROCESS_DETACH:
|
|
WSACleanup();
|
|
break;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|