[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 735
  • Last Modified:

Where is the dll destroy event of an ISAPI dll?

Hi All,

I have an ISAPI dll (using TWebModule) and I need to know where I can put the code for when the DLL is UNloaded from IIS.

I can find the following ok:
thread create (TwebModule.onCreate)
thread destroy (TwebModule.onDestroy)
process create (see below - run when loaded in to IIS)

library dart;
uses
  fastsharemem,
  ActiveX,
  ComObj,
  WebBroker,
  ISAPIApp,
  ISAPIThreadPool,
  Classes;
{$R *.RES}
exports
  GetExtensionVersion,
  HttpExtensionProc,
  TerminateExtension;
begin
  myInitRoutine; // THIS IS RUN WHEN ISAPI IS LOADED IN TO IIS
  CoInitFlags := COINIT_MULTITHREADED;
  Application.Initialize;
  Application.CreateForm(TDARTModule, DARTModule);
  Application.Run;
  // can NOT run myKillRoutine here!
end.

I am wondering where I can put the code to run when the ISAPI dll is UNloaded from IIS (e.g. restart IIS).  This is different from when a thread (request or action) is finished...

Cheers,
Peter
0
petervullings
Asked:
petervullings
1 Solution
 
MadshiCommented:
Add a unit to your project and use its finalization part. Alternatively look at the documentation about DllProc.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now