---
title: AEDisposeExternalProcPtr
framework: coreservices
role: symbol
role_heading: Type Alias
path: coreservices/aedisposeexternalprocptr
---

# AEDisposeExternalProcPtr

Defines a pointer to a function the Apple Event Manager calls to dispose of a descriptor created by the AECreateDescFromExternalPtr function. Your callback function disposes of the buffer you originally passed to that function.

## Declaration

```swift
typealias AEDisposeExternalProcPtr = (UnsafeRawPointer?, Size, SRefCon?) -> Void
```

## Parameters

- `dataPtr`: A pointer to the data to be disposed of. The data must be immutable and must not be freed until this callback function is called.
- `dataLength`: The length, in bytes, of the data in the dataPtr parameter.
- `refcon`: A reference constant, supplied by your application in its original call to doc://com.apple.documentation/documentation/coreservices/1446239-aecreatedescfromexternalptr. The Apple Event Manager passes this value to your dispose function each time it calls it. The reference constant may have a value of 0.

## Return Value

Return Value Your callback routine should not return a value.

## Discussion

Discussion Your application must provide a universal procedure pointer to a dispose function as a parameter to the AECreateDescFromExternalPtr(_:_:_:_:_:_:) function. To provide a pointer to your dispose callback function, you create a universal procedure pointer (UPP) of type AEDisposeExternalProcPtr, using the function NewAEDisposeExternalUPP(_:). You can do so with code like the following: AEDisposeExternalProcPtr MyDisposeCallbackUPP; MyDisposeCallbackUPP = NewAEDisposeExternalUPP (&MyAEDisposeExternalCallback); You can then pass the UPP MyDisposeCallbackUPP as a parameter to the AECreateDescFromExternalPtr function. If you wish to call your dispose callback function directly, you can use the InvokeAEDisposeExternalUPP(_:_:_:_:) function. After you are finished with your dispose callback function, you can dispose of the UPP with the DisposeAEDisposeExternalUPP(_:) function. However, if you will use the same dispose function in subsequent calls to AECreateDescFromExternalPtr, you can reuse the same UPP, rather than dispose of it and later create a new UPP.

## See Also

### Callbacks

- [AERemoteProcessResolverCallback](coreservices/aeremoteprocessresolvercallback.md)
- [AECoerceDescProcPtr](coreservices/aecoercedescprocptr.md)
- [AECoercePtrProcPtr](coreservices/aecoerceptrprocptr.md)
- [AEEventHandlerProcPtr](coreservices/aeeventhandlerprocptr.md)
- [OSLAccessorProcPtr](coreservices/oslaccessorprocptr.md)
- [OSLAdjustMarksProcPtr](coreservices/osladjustmarksprocptr.md)
- [OSLCompareProcPtr](coreservices/oslcompareprocptr.md)
- [OSLCountProcPtr](coreservices/oslcountprocptr.md)
- [OSLDisposeTokenProcPtr](coreservices/osldisposetokenprocptr.md)
- [OSLGetErrDescProcPtr](coreservices/oslgeterrdescprocptr.md)
- [OSLGetMarkTokenProcPtr](coreservices/oslgetmarktokenprocptr.md)
- [OSLMarkProcPtr](coreservices/oslmarkprocptr.md)
