You can also use the UnloadDll function to keep it loaded
Code:
int WINAPI UnloadDll( int timeout ) {

  // DLL unloaded because mIRC exits or /dll -u used
  if ( timeout == 0 ) {

   // clean your DLL stuff here
   return 1;
  }
  // keep DLL in memory (mIRC only wants to unload it because it's been 10 min without use)
  else 
    return 0;
}


The code is in C cause I know jackshit about Delphi =]