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 Hagander||Date: 2001-11-28 13:09:42|
|Subject: Re: Can a windows DLL have more than one process attached? |
|Previous:||From: Hiroshi Inoue||Date: 2001-11-27 23:36:30|
|Subject: Re: ODBC driver with dynamic cursor support ??|