:orphan: # 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) -*** function to be called ## Notes This is used by, for example, `DMInitializePackage()` to have `DMFinalizePackage()` called Use `PetscObjectRegisterDestroy()` to register the destruction of an object in `PetscFinalize()` ## See Also `PetscRegisterFinalizeAll()`, `PetscObjectRegisterDestroy()` ## Level developer ## Location src/sys/objects/destroy.c --- [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](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)