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
typealias AEDisposeExternalProcPtr = (UnsafeRawPointer?, Size, SRefCon?) -> VoidParameters
- 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
dataPtrparameter. - refcon:
A reference constant, supplied by your application in its original call to 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
Your callback routine should not return a value.
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.