# PetscRegisterFinalize
Registers a function that is to be called in `PetscFinalize()` 
## Synopsis
```
#include "petscsys.h"    
PetscErrorCode PetscRegisterFinalize(PetscErrorCode (*f)(void))
```
Not Collective


## Input Parameter

- ***PetscErrorCode (*fun)(void) -*** 





## Note
This is used by, for example, `DMInitializePackage()` to have `DMFinalizePackage()` called


## See Also
 `PetscRegisterFinalizeAll()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/objects/destroy.c.html#PetscRegisterFinalize">src/sys/objects/destroy.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/objects/destroy.c)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
