ffi_poke#

Copy a Perl byte string into memory at address $ptr.

Synopsis#

my $buf = Peta::FFI::alloc(8);
Peta::FFI::poke($buf, pack("l", 42));

What you get back#

The number of bytes written (the string’s byte length).

Edge cases#

  • Fewer than 2 arguments or NULL pointer - croaks; poking through NULL is never meaningful.

  • Buffer too small - writing past an allocation is undefined behaviour; the destination must be at least as large as the string, which the caller controls via alloc.