diff options
author | Bruce Momjian | 1998-10-08 00:10:49 +0000 |
---|---|---|
committer | Bruce Momjian | 1998-10-08 00:10:49 +0000 |
commit | 30debec6e57b0678ec101eb5469d025384ed8c8d (patch) | |
tree | 13beaa143ccd06824ce90b7f5c3f9cfd81377c4d /src/interfaces | |
parent | cb4292ea64749a3faf2a2b6ec737576a39e83f6a (diff) |
Hello!
Here are two new patches for the Win32 support.
1) The patch based on the one from Hiroshi Inoue [[email protected]], 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
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/libpq/libpqdll.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/interfaces/libpq/libpqdll.c b/src/interfaces/libpq/libpqdll.c index d8cb6b6a747..5407c54e409 100644 --- a/src/interfaces/libpq/libpqdll.c +++ b/src/interfaces/libpq/libpqdll.c @@ -1,8 +1,25 @@ #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; } |