# PetscObjectListAdd
Adds a new object to an `PetscObjectList` 
## Synopsis
```
PetscErrorCode PetscObjectListAdd(PetscObjectList *fl, const char name[], PetscObject obj)
```

## Input Parameters

- ***fl -*** the object list
- ***name -*** the name to use for the object
- ***obj -*** the object to attach





## Notes
Replaces item if it is already in list. Removes item if you pass in a NULL object.

Use `PetscObjectListFind()` or `PetscObjectListReverseFind()` to get the object back


## See Also
 `PetscObjectListDestroy()`, `PetscObjectListFind()`, `PetscObjectListDuplicate()`, `PetscObjectListReverseFind()`, `PetscObjectListDuplicate()`

## Level
developer

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


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