---
title: "SecStaticCodeCreateWithPath(_:_:_:)"
framework: security
role: symbol
role_heading: Function
path: "security/secstaticcodecreatewithpath(_:_:_:)"
---

# SecStaticCodeCreateWithPath(_:_:_:)

Creates a static code object representing the code at a specified file system path.

## Declaration

```swift
func SecStaticCodeCreateWithPath(_ path: CFURL, _ flags: SecCSFlags, _ staticCode: UnsafeMutablePointer<SecStaticCode?>) -> OSStatus
```

## Parameters

- `path`: A URL identifying the location on disk of the code for which you want a static code object. For bundles, pass a URL to the root directory of the bundle. For single files, pass a URL to the file. If you pass a URL to the main executable of a bundle, the bundle as a whole is generally recognized. Only absolute paths should be used.
- `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.
- `staticCode`: On return, the static code object representing the code you specified in the path parameter.

## Return Value

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

## Discussion

Discussion A static code object is not inherently linked to running code in the system. It is possible to create a static code object from unsigned code. Although most uses of such an object cause the function to fail and return the result code errSecCSUnsigned error, you can call the SecCodeCopyPath(_:_:_:) and SecCodeCopySigningInformation(_:_:_:) functions for such objects.

## See Also

### Related Documentation

- [SecCodeCopyPath(_:_:_:)](security/seccodecopypath(_:_:_:).md)
- [SecCodeCopyStaticCode(_:_:_:)](security/seccodecopystaticcode(_:_:_:).md)
