FreeSurrogate Method
Collapse the table of content
Expand the table of content

ISurrogate::FreeSurrogate method

Unloads a DLL server.

Syntax


HRESULT FreeSurrogate();

Parameters

This method has no parameters.

Return value

This method can return the standard return values E_UNEXPECTED, E_FAIL, and S_OK.

Remarks

COM calls FreeSurrogate when there are no more DLL servers running in the surrogate process. When FreeSurrogate is called, the method must properly revoke all of the class factories registered in the surrogate, and then cause the surrogate process to exit.

Surrogate processes must call the CoFreeUnusedLibraries function periodically to unload DLL servers that are no longer in use. The surrogate process assumes this responsibility, which would normally be the client's responsibility. CoFreeUnusedLibraries calls the DllCanUnloadNow function on any loaded DLL servers. Because CoFreeUnusedLibraries depends on the existence and proper implementation of DllCanUnloadNow in DLL servers, it is not guaranteed to unload all DLL servers that should be unloaded --not every server implements DllCanUnloadNow, and this function is unreliable for free-threaded DLLs. Additionally, the surrogate has no way of being informed when all DLL servers are gone. COM, however, can determine when all DLL servers have been unloaded, and will then call the FreeSurrogate method.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps | Windows Store apps]

Minimum supported server

Windows 2000 Server [desktop apps | Windows Store apps]

Header

ObjIdl.h

IDL

ObjIdl.idl

IID

IID_ISurrogate is defined as 00000022-0000-0000-C000-000000000046

See also

DllSurrogate
ISurrogate
Writing a Custom Surrogate

 

 

Show:
© 2016 Microsoft