At the end of a client program, the SOMD_Uninit procedure must be called to free DSOM run-time objects, and to release system resources such as semaphores, shared memory segments, and so on. SOMD_Uninit should be called even if the client program terminates unsuccessfully; otherwise, system resources will not be released.
For example, the exit code in the client program might look like this:
... SOMD_Uninit(&e); SOM_UninitEnvironment(&e); }
Note also the SOM_UninitEnvironment call, which frees any memory associated with the specified Environment structure.
Note: When a Windows DSOM client receives a WM-QUIT message while processing a remote method invocation, DSOM will clean up and terminate the client without returning to the client's WinProc or WinMain.