---
title: cloneCommand
framework: kernel
role: symbol
role_heading: Instance Method
path: kernel/iodmacommand/1547732-clonecommand
---

# cloneCommand

Creates a new command based on the specification of the current one.

## Declaration

```occ
virtual OSPtr<IODMACommand> cloneCommand(void *refCon);
```

## Return Value

Return Value Returns a new memory cursor if successfully created and initialised, 0 otherwise.

## Discussion

Discussion Factory function to create and initialise an IODMACommand in one operation. The current command's specification will be duplicated in the new object, but however none of its state will be duplicated. This means that it is safe to clone a command even if it is currently active and running, however you must be certain that the command to be duplicated does have a valid reference for the duration.

## See Also

### Creating a DMA Command

- [withSpecification](kernel/iodmacommand/1811330-withspecification.md)
- [withSpecification](kernel/iodmacommand/1547758-withspecification.md)
- [withSpecification](kernel/iodmacommand/3516452-withspecification.md)
- [initWithSpecification](kernel/iodmacommand/1811207-initwithspecification.md)
- [initWithSpecification](kernel/iodmacommand/1547748-initwithspecification.md)
- [initWithSpecification](kernel/iodmacommand/3516450-initwithspecification.md)
- [weakWithSpecification](kernel/iodmacommand/1811323-weakwithspecification.md)
- [withRefCon](kernel/iodmacommand/1547747-withrefcon.md)
- [initWithRefCon](kernel/iodmacommand/1547754-initwithrefcon.md)
- [cloneCommand](kernel/iodmacommand/1811059-clonecommand.md)
- [init](driverkit/iodmacommand/3645796-init.md)
- [free](kernel/iodmacommand/1547725-free.md)
- [MappingOptions](kernel/iodmacommand/mappingoptions.md)
- [SynchronizeOptions](kernel/iodmacommand/synchronizeoptions.md)
