# PetscStackCallExternalVoid
Calls an external library routine or user function after pushing the name of the routine on the stack. 
## Input Parameters

- ***name -*** string that gives the name of the function being called
- ***routine -*** actual call to the routine, for example, functionname(a,b)





## Note
Often one should use `PetscCallExternal()` instead. This routine is intended for external library routines that DO NOT return error codes

In debug mode this also checks the memory for corruption at the end of the function call.

Certain external packages, such as BLAS/LAPACK may have their own macros for managing the call, error checking, etc.


## Developer Note
This is so that when a user or external library routine results in a crash or corrupts memory, they get blamed instead of PETSc.


## See Also
 `PetscCall()`, `PetscStackPushNoCheck()`, `PetscStackPush()`, `PetscCallExternal()`, `PetscCallBLAS()`
@*/
#define PetscStackCallExternalVoid(name, routine) \
do { \
PetscStackPush(name); \
routine; \
PetscStackPop; \
} while (0)

/*MC
PetscCallExternal - Calls an external library routine that returns an error code after pushing the name of the routine on the stack.


## Input Parameters

- ***func-*** name of the routine
- ***args -*** arguments to the routine





## Notes
This is intended for external package routines that return error codes. Use `PetscStackCallExternalVoid()` for those that do not.

In debug mode this also checks the memory for corruption at the end of the function call.

Assumes the error return code of the function is an integer and that a value of 0 indicates success


## Developer Note
This is so that when an external package routine results in a crash or corrupts memory, they get blamed instead of PETSc.


## See Also
 `PetscCall()`, `PetscStackPushNoCheck()`, `PetscStackPush()`, `PetscStackCallExternalVoid()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petscerror.h.html#PetscStackCallExternalVoid">include/petscerror.h</A>


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