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

From: Mikhail Terekhov <terekhov(at)emc(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Can a windows DLL have more than one process attached?
Date: 2001-11-29 00:53:08
Message-ID: 3C0586F4.2070703@emc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

> where netmsgModule is
>
> static HINSTANCE netmsgModule = NULL;
>

That is definitely my bug (cut&paste problem:(). There shouldn't be a
static variable in *.h files. Sorry :(.

> This sure looks to me like it will fail miserably if more than one
> process can attach to the DLL concurrently: won't the first one to
> detach release the netmsg library, breaking access to it for all the
> remaining processes?
>

There is no problem here - LoadLibrary and FreeLibrary use reference
count (see references in the Ross's message).

> I don't know enough about Windows to know if there's really a problem
> here, but the code looks fishy to me. I'd expect to need a reference
> count. Comments anyone?
>
Windows really does reference count here.

Regards,
Mikhail

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Mikhail Terekhov 2001-11-29 00:59:31 Re: Can a windows DLL have more than one process attached?
Previous Message Tom Lane 2001-11-28 19:00:36 Re: Can a windows DLL have more than one process attached?