Skip site navigation (1) Skip section navigation (2)

Re: Can a windows DLL have more than one process attached?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Can a windows DLL have more than one process attached?
Date: 2001-11-28 00:40:11
Message-ID: 176.1006908011@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-interfaces
Actually, the more I look at this, the more broken it looks.

(1) netmsgModule and winsock_strerror_buf are declared as static
variables in libpq/win32.h.  Unless Windows has some truly creative new
interpretation of static variables, this means that there'll be a
separate instance of these vars in each .c file that #includes win32.h.
Wasting half a K of space per .c file is the least of the consequences.

(2) Since libpqdll.c and fe-misc.c don't share the same instance of
netmsgModule, winsock_strerror will always see it as NULL regardless
of what DllMain has done or not done.

(3) Even if winsock_strerror saw netmsgModule, it doesn't pass it to
FormatMessage, which means (if I'm reading the documentation I found on
the net correctly) that the wrong message table would be searched.
I think that the "0" parameter should be netmsgModule instead.

Have we got any people who actually know the Windows platform and
can confirm or deny these points?

I'd be happy to change the code to something that looks reasonable to
me, but I'm in no position to test it.

			regards, tom lane

In response to

pgsql-interfaces by date

Next:From: Magnus HaganderDate: 2001-11-28 13:09:42
Subject: Re: Can a windows DLL have more than one process attached?
Previous:From: Hiroshi InoueDate: 2001-11-27 23:36:30
Subject: Re: ODBC driver with dynamic cursor support ??

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group