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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Magnus Hagander" <mha(at)sollentuna(dot)net>
Cc: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Can a windows DLL have more than one process attached?
Date: 2001-11-28 19:00:36
Message-ID: 3255.1006974036@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

"Magnus Hagander" <mha(at)sollentuna(dot)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

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Mikhail Terekhov 2001-11-29 00:53:08 Re: Can a windows DLL have more than one process attached?
Previous Message Magnus Hagander 2001-11-28 13:09:42 Re: Can a windows DLL have more than one process attached?