# PetscHeaderCreate
Creates a PETSc object of a particular class 
## Synopsis
```
#define PetscHeaderCreate(h, classid, class_name, descr, mansec, comm, destroy, view) \
  (PetscNew(&(h)) || PetscHeaderCreate_Private((PetscObject)(h), classid, class_name, descr, mansec, comm, (PetscObjectDestroyFunction)(destroy), (PetscObjectViewFunction)(view)) || PetscLogObjectCreate(h))

PETSC_EXTERN PetscErrorCode PetscComposedQuantitiesDestroy(PetscObject obj);
PETSC_EXTERN PetscErrorCode PetscHeaderCreate_Private(PetscObject, PetscClassId, const char[], const char[], const char[], MPI_Comm, PetscObjectDestroyFunction, PetscObjectViewFunction);
PETSC_INTERN PetscObjectId  PetscObjectNewId_Internal(void);

/*@C
    PetscHeaderDestroy - Final step in destroying a PetscObject

    Input Parameters:
.   h - the header created with `PetscHeaderCreate()`

    

.seealso: `PetscHeaderCreate()`
@*/
#define PetscHeaderDestroy(h) (PetscHeaderDestroy_Private((PetscObject)(*(h)), PETSC_FALSE) || PetscFree(*(h)))

PETSC_EXTERN PetscErrorCode                PetscHeaderDestroy_Private(PetscObject, PetscBool);
PETSC_SINGLE_LIBRARY_INTERN PetscErrorCode PetscHeaderReset_Internal(PetscObject);
PETSC_EXTERN PetscErrorCode                PetscObjectCopyFortranFunctionPointers(PetscObject, PetscObject);
PETSC_EXTERN PetscErrorCode                PetscObjectSetFortranCallback(PetscObject, PetscFortranCallbackType, PetscFortranCallbackId *, void (*)(void), void *ctx);
PETSC_EXTERN PetscErrorCode                PetscObjectGetFortranCallback(PetscObject, PetscFortranCallbackType, PetscFortranCallbackId, void (**)(void), void **ctx);

PETSC_INTERN PetscErrorCode PetscCitationsInitialize(void);
PETSC_INTERN PetscErrorCode PetscFreeMPIResources(void);
PETSC_INTERN PetscErrorCode PetscOptionsHasHelpIntro_Internal(PetscOptions, PetscBool *);

/* Code shared between C and Fortran */
PETSC_INTERN PetscErrorCode PetscInitialize_Common(const char *, const char *, const char *, PetscBool, PetscBool, PetscInt);

#if PetscDefined(HAVE_SETJMP_H)
PETSC_EXTERN PetscBool PetscCheckPointer(const void *, PetscDataType);
#else
  #define PetscCheckPointer(ptr, data_type) (ptr ? PETSC_TRUE : PETSC_FALSE)
#endif
#if !defined(PETSC_CLANG_STATIC_ANALYZER)
  /*
    Macros to test if a PETSc object is valid and if pointers are valid
*/
  #if !defined(PETSC_USE_DEBUG)

    #define PetscValidHeaderSpecific(h, ck, arg) \
      do
```

## Input Parameters

- ***classid -*** the classid associated with this object (for example VEC_CLASSID)
- ***class_name -*** string name of class; should be static (for example "Vec")
- ***descr -*** string containing short description; should be static (for example "Vector")
- ***mansec -*** string indicating section in manual pages; should be static (for example "Vec")
- ***comm -*** the MPI Communicator
- ***destroy -*** the destroy routine for this object (for example `VecDestroy()`)
- ***view -*** the view routine for this object (for example `VecView()`)



## Output Parameter

- ***h -*** the newly created object





## See Also
 `PetscHeaderDestroy()`, `PetscClassIdRegister()`


## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petsc/private/petscimpl.h.html#PetscHeaderCreate">include/petsc/private/petscimpl.h</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex48.c.html">src/snes/tutorials/ex48.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex14.c.html">src/ts/tutorials/ex14.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petsc/private/petscimpl.h)


[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)  
