Bug #641: LIBPQ Linking with the static library on the WIN32 platform fails connections with "unknown host name".

Поиск
Список
Период
Сортировка
От pgsql-bugs@postgresql.org
Тема Bug #641: LIBPQ Linking with the static library on the WIN32 platform fails connections with "unknown host name".
Дата
Msg-id 20020422205750.47BFC47589E@postgresql.org
обсуждение исходный текст
Список pgsql-bugs
Jason Erickson (jerickso@indian.com) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
LIBPQ Linking with the static library on the WIN32 platform fails connections with "unknown host name".

Long Description
I was having problems connecting up to a remote PostgreSQL database when I linked a program with the static library,
receivingthe error "unknown host name: 198.168.100.254".  I was not experiencing this problem when I linked with the
DLL.

Client: Microsoft Visual C++ 6.0, PostgreSQL 7.2.1
Server: FreeBSD 4.4-Stable, PosotgreSQL 7.2.1

I traced this down to the fact that with the static version of the library, the WinSock initialization functions are
notbeing called (WSAStartup).  The DLL calls the WinSock initialization function in the DllMain function.
 

I have included what I used to patch the file fe-connect.c in the example code section.  This solution calls WSAStartup
forevery connection and WSACleanup for every closing call.  I am not sure if I have all the exit paths.  This patch
mightnot be the best way to solve the problem, since the initialization function only needs to be called once, not for
everyconnection.
 



Sample Code
834c834,843
< 
---
> #if WIN32
>         WSADATA wsaData;
>         if (WSAStartup(MAKEWORD(1, 1), &wsaData))
>         {
>             printfPQExpBuffer(&conn->errorMessage,
>               libpq_gettext("Unable to Initialize WSA\n"));
>             goto connect_errReturn;
>         }
>         WSASetLastError(0);
> #endif
988a998
>             WSACleanup();
1029a1040
>         WSACleanup();
1909a1921
>         WSACleanup();
1982a1995
>         WSACleanup();
2159a2173
>     WSACleanup();


No file was uploaded with this report

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Thomas Lockhart
Дата:
Сообщение: Re: Bug #638: Buggy select statment with numeric
Следующее
От: pgsql-bugs@postgresql.org
Дата:
Сообщение: Bug #642: Need "Alter table drop column"