Re: MinGW compiled client library

From: Michael Cronenworth <mike(at)cchtml(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: MinGW compiled client library
Date: 2013-08-15 15:59:14
Message-ID: 520CFAD2.8000304@cchtml.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
postgresql-mingw-errno.patch text/x-patch 662 bytes
postgresql-mingw-errno1.patch text/x-patch 2.0 KB
postgresql-mingw-errno2.patch text/x-patch 1.2 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Janes 2013-08-15 15:59:23 Re: Why doesn't COPY support the HEADER options for tab-separated output?
Previous Message Alban Hertroys 2013-08-15 15:49:21 Re: Getting list of supported types in Postgres