Re: Can a windows DLL have more than one process attached? - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: Can a windows DLL have more than one process attached?
Date
Msg-id 3255.1006974036@sss.pgh.pa.us
Whole thread Raw
In response to Re: Can a windows DLL have more than one process attached?  ("Magnus Hagander" <mha@sollentuna.net>)
List pgsql-interfaces
"Magnus Hagander" <mha@sollentuna.net> writes:
> In general, depending on doing things in DllMain is not a good idea.
> The fact that we do WSAStartup() in it is even deprecated in the docs
> now, ...
> The question is if it should be moved to the connection functions, or if
> it shuold be left up to the application to do it. Moving it to the
> connection functino would be easy, but each call to WSAStartup() should
> have a corresponding WSACleanup() call...
> Or if we should just leave it :-) Because it appears to work...

Well, it's been that way since day one and we've not had any reports of
problems, so I'm inclined to leave it alone until we see a problem.

However, this netmsg.dll reference is new code in 7.2 and is evidently
not well tested :-(.

>> If this is a problem, a possible answer is not to try to cache the
>> netmsg reference at all, but just to load and unload that DLL at the
>> single point where it's used.  Since we only use it to translate
>> socket error reports, there's probably no big performance penalty
>> involved to do it that way.

> That's probably the best idea.

Okay, I'll make the changes and then ask you to test it.  Do you have a
copy of netmsg.dll?

> I can probably do some testing - assuming the 7.2 client libs can still
> talk to 7.1 servers, since I haven't any servers up on the new version
> yet...

Should work fine.  But the code we're interested in testing here is a
fallback code path --- it only gets exercised if the main system doesn't
have a string for the error message.  You might need to dike out the
first FormatMessage call in winsock_strerror in order to test.
        regards, tom lane


pgsql-interfaces by date:

Previous
From: "Magnus Hagander"
Date:
Subject: Re: Can a windows DLL have more than one process attached?
Next
From: Mikhail Terekhov
Date:
Subject: Re: Can a windows DLL have more than one process attached?