Re: MinGW compiled client library - Mailing list pgsql-general

From Michael Cronenworth
Subject Re: MinGW compiled client library
Date
Msg-id 520CFAD2.8000304@cchtml.com
Whole thread Raw
In response to MinGW compiled client library  (Michael Cronenworth <mike@cchtml.com>)
Responses Re: MinGW compiled client library  (Michael Cronenworth <mike@cchtml.com>)
List pgsql-general
On 08/13/2013 12:35 PM, Michael Cronenworth wrote:
> When the client library (version 9.2.x) is compiled with a MinGW-w64 environment
> the resulting libpq.dll will not function. This has been reported previously
> with two bug reports, which have gone untouched.
>
> Bug 8151:
> http://www.postgresql.org/message-id/E1UbELM-0007NK-5L@wrigleys.postgresql.org
> Bug 8162:
> http://www.postgresql.org/message-id/E1UcLPd-0000L4-TI@wrigleys.postgresql.org
>
> I have tried compiling with every option enabled and every option disabled. Does
> anyone have any pointers or would anyone be willing to help solve this issue?

The connection problem was caused by incorrect error code checking after
connect(). The libpq interface defines a macro "SOCK_ERRNO" that on windows
calls WSAGetLastError(), which returns a Windows error code. The check after
connect() compares the Windows error code against the UNIX errno
EINPROGRRESS/EWOULDBLOCK.

I see there is a test in win32.h to see if EINPROGRESS is defined. It may not
have been defined in very old MinGW environments, but it is defined now. The
attached patches resolve the issue.

The compiled libpq.dll allows me to connect and run a SELECT and print out data.

Attachment

pgsql-general by date:

Previous
From: Jeff Janes
Date:
Subject: Re: Why doesn't COPY support the HEADER options for tab-separated output?
Next
From: Perry Smith
Date:
Subject: Immediate Constraints