CFunctionPointer

struct CFunctionPointer<T>

The family of C function pointer types.

In imported APIs, T is a Swift function type such as (Int)->String.

Though not directly useful in Swift, CFunctionPointer<T> can be used to safely pass a C function pointer, received from one C or Objective-C API, to another C or Objective-C API.

Inheritance CVarArgType, DebugPrintable, Equatable, Hashable, NilLiteralConvertible View Protocol Hierarchy →
Import import Swift

Initializers

init()

Create a nil instance.

Declaration

init()
init(_:)

Reinterpret the bits of value as CFunctionPointer<T>.

Warning: This is a fundamentally unsafe operation, equivalent to unsafeBitCast(value, CFunctionPointer<T>.self)

Declaration

init(_ value: COpaquePointer)
init(nilLiteral:)

Create an instance initialized with nil.

Declaration

init(nilLiteral: ())

Instance Variables

var debugDescription: String

A textual representation of self, suitable for debugging.

Declaration

var debugDescription: String { get }
var hashValue: Int

The hash value.

Axiom: x == y implies x.hashValue == y.hashValue

Note: the hash value is not guaranteed to be stable across different invocations of the same program. Do not persist the hash value across program runs.

Declaration

var hashValue: Int { get }

Instance Methods

func encode()

Transform self into a series of machine words that can be appropriately interpreted by C varargs

Declaration

func encode() -> [Word]