Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Peta::FFI

pperl-specific module built into the interpreter. Runtime: PP.

Peta::FFI — Dynamic FFI for calling C library functions from Perl

Three layers:

  • Layer 0: Raw FFI via dlopen() + call() — user provides type signatures
  • Layer 1: Pre-baked bindings — Peta::FFI::Libc, Peta::FFI::UUID
  • Layer 2: Discovery — scan() enumerates available libraries and functions

Uses libffi for the raw call dispatch — any C function signature works.

Functions

call

dlclose

dlopen

ffi_call

call C function via libffi

ffi_dlclose

close library handle

ffi_dlopen

returns library handle as integer

ffi_scan

returns hashref of { soname => path } for all system libraries

scan