1FFI::Platypus::FunctionU(s3e)r Contributed Perl DocumentaFtFiIo:n:Platypus::Function(3)
2
3
4
6 FFI::Platypus::Function - An FFI function object
7
9 version 2.08
10
12 use FFI::Platypus 2.00;
13
14 # call directly
15 my $ffi = FFI::Platypus->new( api => 2 );
16 my $f = $ffi->function(puts => ['string'] => 'int');
17 $f->call("hello there");
18
19 # attach as xsub and call (faster for repeated calls)
20 $f->attach('puts');
21 puts('hello there');
22
24 This class represents an unattached platypus function. For more
25 context and better examples see FFI::Platypus.
26
28 attach
29 $f->attach($name);
30 $f->attach($name, $prototype);
31
32 Attaches the function as an xsub (similar to calling attach directly
33 from an FFI::Platypus instance). You may optionally include a
34 prototype.
35
36 call
37 my $ret = $f->call(@arguments);
38 my $ret = $f->(@arguments);
39
40 Calls the function and returns the result. You can also use the
41 function object like a code reference.
42
43 sub_ref
44 my $code = $f->sub_ref;
45
46 Returns an anonymous code reference. This will usually be faster than
47 using the "call" method above.
48
50 Author: Graham Ollis <plicease@cpan.org>
51
52 Contributors:
53
54 Bakkiaraj Murugesan (bakkiaraj)
55
56 Dylan Cali (calid)
57
58 pipcet
59
60 Zaki Mughal (zmughal)
61
62 Fitz Elliott (felliott)
63
64 Vickenty Fesunov (vyf)
65
66 Gregor Herrmann (gregoa)
67
68 Shlomi Fish (shlomif)
69
70 Damyan Ivanov
71
72 Ilya Pavlov (Ilya33)
73
74 Petr Písař (ppisar)
75
76 Mohammad S Anwar (MANWAR)
77
78 Håkon Hægland (hakonhagland, HAKONH)
79
80 Meredith (merrilymeredith, MHOWARD)
81
82 Diab Jerius (DJERIUS)
83
84 Eric Brine (IKEGAMI)
85
86 szTheory
87
88 José Joaquín Atria (JJATRIA)
89
90 Pete Houston (openstrike, HOUSTON)
91
93 This software is copyright (c) 2015-2022 by Graham Ollis.
94
95 This is free software; you can redistribute it and/or modify it under
96 the same terms as the Perl 5 programming language system itself.
97
98
99
100perl v5.38.0 2023-07-20 FFI::Platypus::Function(3)