Standard Library



An OpaquePointer represents a pointer to any pointer, comparable to void* in C. This can be subclassed to add methods to a C API or ABI.

Example: Subclassing

private func fgets(string: ByteSequence, length: UInt32, stream: CFile) -> ByteSequence
class CFile: OpaquePointer {
    init(path: ByteSequence, mode: ByteSequence) external(fopen)

    func read(string: ByteSequence, length: UInt32) -> ByteSequence {
        return fgets(string: string, length: length, stream: self)