---
title: "SecCodeCopyHost(_:_:_:)"
framework: security
role: symbol
role_heading: Function
path: "security/seccodecopyhost(_:_:_:)"
---

# SecCodeCopyHost(_:_:_:)

Retrieves the code object for the host of specified guest code.

## Declaration

```swift
func SecCodeCopyHost(_ guest: SecCode, _ flags: SecCSFlags, _ host: UnsafeMutablePointer<SecCode?>) -> OSStatus
```

## Parameters

- `guest`: A valid code object representing code running on the system as the guest of other code.
- `flags`: Optional flags; see doc://com.apple.security/documentation/Security/SecCSFlags for possible values. Pass doc://com.apple.security/documentation/Security/SecCSFlags/kSecCSDefaultFlags for standard behavior.
- `host`: On return, the code object of the host of the code specified in the guest parameter.

## Return Value

Return Value A result code. See Code Signing Services Result Codes.

## Discussion

Discussion Host code acts as the supervisor and controller of its guest code and is the ultimate authority on the dynamic validity and status of its guests.
