Crossware

Table of Contents        Previous topic       Next topic       

The Extension Interface->General Purpose Interface Calls->PreCloseExtensions()

extern "C" void PreCloseExtensions(LONG nExtensionState)

Each extension will receive this call before the the Virtual Workshop starts to close down its extensions.  It has been provided so that an extension is forewarned that other extensions are about to close.  This is necessary if, for instance, an extension has opened a communication channel (such as a named pipe) to another extension.  It might need to detach itself from this communication channel (ie close the handle) before the other extension closes.

For example:

esim0.dll creates a named pipe.
esim1.dll connects to this named pipe.

At close down, esim0.dll will be closed before esim1.dll.  Problems can occur if esim0.dll destroys the named pipe while esim1.dll is still attached to it.

Therefore esim1.dll responds to the PreCloseExtensions call by closing its handle to the named pipe.  

Then, when esim0.dll closes and destroys the named pipe, there is nothing else attached to it.