When a DLL is loaded by an application, Windows may map the DLL into the address space of other processes, depending on what the DLL does. This means that even if an application subsequently unloads the DLL, it may still be locked.
This can also happen, for example, if you are using Visual Studio to debug an application (see
here). The only solution is to exit Visual Studio and/or mIRC.
And it can happen in
other situations as well.
It can also happen if the DLL, or DLLs that are loaded by it, call certain APIs.
Apart from that, if $dll(0) shows that the DLL has been unloaded, this means that mIRC called FreeLibrary() to release it. If the DLL is still locked, this means that something external to mIRC is preventing it from being released.