read_ints
fn read_ints(int lib, int ptr, int count) -> Result<Vec<int>, Error> Import
Source: use ffi::{read_ints}; compiler/src/builtin_docs/ffi.hy Copies count 64-bit integers (int64_t) from native memory at ptr.
For C APIs that return a pointer to an array, such as PCRE2’s
pcre2_get_ovector_pointer. lib must be a handle from dload (else
ErrorKind::InvalidHandle): reading native memory is part of the FFI
grant. A null ptr or a count outside 0..=1048576 is
ErrorKind::Unsupported. The pointer itself cannot be checked, so it
must point at count readable words.
Parameters#
| Name | Type |
|---|---|
lib | int |
ptr | int |
count | int |
Returns#
Result<Vec<int>, Error>
Examples#
use ffi::{read_ints};
// Start and end offsets of every group in the last match: 2 words each.
let ovector = read_ints(lib, pcre2_get_ovector_pointer_8(match_data), groups * 2)?;
let first_start = ovector[0];
See also#
ffi::dloadffi::ErrorKinddeclare: Looks up the C functionnamein a loaded library and records its signature.invoke: Calls a function registered withdeclare, passing the tupleargs.