# PetscObjectAddOptionsHandler
Adds an additional function to check for options when XXXSetFromOptions() is called. 
## Synopsis
```
#include "petscsys.h"    
PetscErrorCode PetscObjectAddOptionsHandler(PetscObject obj, PetscErrorCode (*handle)(PetscObject, PetscOptionItems *, void *), PetscErrorCode (*destroy)(PetscObject, void *), void *ctx)
```
Not Collective


## Input Parameters

- ***obj -*** the PETSc object
- ***handle -*** function that checks for options
- ***destroy -*** function to destroy context if provided
- ***ctx -*** optional context for check function





## See Also
 `KSPSetFromOptions()`, `PCSetFromOptions()`, `SNESSetFromOptions()`, `PetscObjectProcessOptionsHandlers()`, `PetscObjectDestroyOptionsHandlers()`

## Level
developer

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


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/objects/inherit.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)  
