XU XUv0.13.1
中文

#ffi

import: #ffi

counts: 4 functions, 0 methods, 0 types, 0 constants, 0 method sets

C interoperation helpers for code that calls extern "C" functions. Pointers are c_ptr values: addresses of C memory that Xu cannot borrow check. Everything here that touches memory behind a c_ptr is an unsafe fn, callable only inside `unsafe { }`; the caller vouches that the address is valid for the access. Offsets are in bytes.

null

XuAPI
pub fn null() c_ptr

Purpose

The null pointer.

Parameters

No arguments are required.

Returns

c_ptr — a value of this type

is_null

XuAPI
pub fn is_null(p c_ptr) bool

Purpose

Whether it is null.

Parameters

p c_ptr
p (c_ptr)

Returns

bool — true or false

offset

XuAPI
pub fn offset(p c_ptr, bytes int) c_ptr

Purpose

Address arithmetic; no access happens.

Parameters

p c_ptr
p (c_ptr)
bytes int
bytes (int)

Returns

c_ptr — a value of this type

addr

XuAPI
pub fn addr(p c_ptr) int

Purpose

Address.

Parameters

p c_ptr
p (c_ptr)

Returns

int — a value of this type