FFI::Platypus::Function(3pm)

FFI::Platypus::Function3pm

An ffi function object

Usage

 use FFI::Platypus 2.00;
 
 # call directly
 my $ffi = FFI::Platypus->new( api => 2 );
 my $f = $ffi->function(puts => ['string'] => 'int');
 $f->call("hello there");
 
 # attach as xsub and call (faster for repeated calls)
 $f->attach('puts');
 puts('hello there');

Version

version 2.10

Overview

This class represents an unattached platypus function. For more context and better examples see FFI::Platypus.

Methods

attach

 $f->attach($name);
 $f->attach($name, $prototype);

Attaches the function as an xsub (similar to calling attach directly from an FFI::Platypus instance). You may optionally include a prototype.

call

 my $ret = $f->call(@arguments);
 my $ret = $f->(@arguments);

Calls the function and returns the result. You can also use the function object like a code reference.

sub_ref

 my $code = $f->sub_ref;

Returns an anonymous code reference. This will usually be faster than using the "call" method above.

Releases

4 releases since Debian 10 (Buster); the text changed 3 times.

  1. 10
  2. 11
  3. 12
  4. 13

Author

Author: Graham Ollis <[email protected]>

Contributors:

Bakkiaraj Murugesan (bakkiaraj)

Dylan Cali (calid)

pipcet

Zaki Mughal (zmughal)

Fitz Elliott (felliott)

Vickenty Fesunov (vyf)

Gregor Herrmann (gregoa)

Shlomi Fish (shlomif)

Damyan Ivanov

Ilya Pavlov (Ilya33)

Petr Písař (ppisar)

Mohammad S Anwar (MANWAR)

Håkon Hægland (hakonhagland, HAKONH)

Meredith (merrilymeredith, MHOWARD)

Diab Jerius (DJERIUS)

Eric Brine (IKEGAMI)

szTheory

José Joaquín Atria (JJATRIA)

Pete Houston (openstrike, HOUSTON)

Lukas Mai (MAUKE)

From libffi-platypus-perl 2.10-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.