# %CoRelease interface

Release a dispatch or COM object when done.

## Syntax

```
retcode = %CoRelease(Param1, Param2)
```

## Parameter(s)

| Param1 [in] | Dispatch object to be released. |
| --- | --- |
| Param2 [in] | Boolean: FALSE to release just the dispatch object passed-in, TRUE to release the COM object to which this dispatch object belongs. |

## Returns

A Boolean (Success or Fail)

## Error Handling

Call CoGetException to get an error description.

## Comments

- If releasing a dispatch object, the IDispatch of this object is released and the object is removed from the cache.

- If releasing a COM object:

- After release, all variants that have been associated with this COM object are released.

- After release, all IDispatch that have been associate with this COM object are released.

- After release, all method names that have been associated with this COM object and its associated IDs (DISPIDs) are released.

- Clean up whatever you have put in cache.

Note: A call to release a COM object releases all resources
associated with this COM object and removes it from the COM object
list. This call does not uninitialize the COM library. The user must
call %CoUninitialize before terminating the FlashBASIC
module.

## See also

- [Using the COM interface to FlashBASIC](https://d3codex.com/pickbasic-flashbasic/using-the-com-interface-to-flashbasic/)
- [FlashBASIC automation application interfaces](https://d3codex.com/pickbasic-flashbasic/flashbasic-automation-application-interfaces/)

---
Source: https://d3codex.com/pickbasic-flashbasic/corelease-interface/ - part of the D3Codex reference.
