---
title: "AECreateDesc(_:_:_:_:)"
framework: coreservices
role: symbol
role_heading: Function
path: coreservices/1448535-aecreatedesc
---

# AECreateDesc(_:_:_:_:)

Creates a new descriptor that incorporates the specified data.

## Declaration

```swift
func AECreateDesc(_ typeCode: DescType, _ dataPtr: UnsafeRawPointer!, _ dataSize: Size, _ result: UnsafeMutablePointer<AEDesc>!) -> OSErr
```

## Parameters

- `typeCode`: The descriptor type for the new descriptor. For a list of AppleScript’s predefined descriptor types, see doc://com.apple.documentation/documentation/coreservices/apple_events/1542788-descriptor_type_constants. See doc://com.apple.documentation/documentation/coreservices/desctype.
- `dataPtr`: A pointer to the data for the new descriptor. This data is copied into a newly-allocated block of memory for the descriptor that is created. To minimize copying overhead, consider using doc://com.apple.documentation/documentation/coreservices/1446239-aecreatedescfromexternalptr.
- `dataSize`: The length, in bytes, of the data for the new descriptor.
- `result`: A pointer to a descriptor. On successful return, a descriptor that incorporates the data specified by the dataPtr parameter. On error, a null descriptor. If the function returns successfully, your application should call the doc://com.apple.documentation/documentation/coreservices/1444208-aedisposedesc function to dispose of the resulting descriptor after it has finished using it. See doc://com.apple.documentation/documentation/coreservices/aedesc.

## Return Value

Return Value A result code. See Result Codes.

## Discussion

Discussion While it is possible to create an Apple event descriptor or a descriptor list or a descriptor with the AECreateDesc function (assuming you have access to the raw data for an Apple event, list, or descriptor), you typically create these structured objects with their specific creation routines—AECreateAppleEvent, AECreateList, or AECreateDesc.  Version-Notes Thread safe starting in OS X v10.2.

## See Also

### Creating and Duplicating Descriptors

- [AECreateDescFromExternalPtr(_:_:_:_:_:_:)](coreservices/1446239-aecreatedescfromexternalptr.md)
- [AEDuplicateDesc(_:_:)](coreservices/1442661-aeduplicatedesc.md)
