1FFI::Platypus::API(3) User Contributed Perl DocumentationFFI::Platypus::API(3)
2
3
4

NAME

6       FFI::Platypus::API - Platypus arguments and return value API for custom
7       types
8

VERSION

10       version 1.58
11

SYNOPSIS

13        package FFI::Platypus::Type::MyCustomType;
14
15        use FFI::Platypus::API;
16
17        sub ffi_custom_type_api_1
18        {
19          {
20            native_type => 'uint32',
21            perl_to_native => sub {
22              my($value, $i) = @_;
23              # Translates ($value) passed in from Perl
24              # into ($value+1, $value+2)
25              arguments_set_uint32($i, $value+1);
26              arguments_set_uint32($i+1, $value+2);
27            },
28            argument_count => 2,
29          }
30        }
31

DESCRIPTION

33       NOTE: I added this interface early on to FFI::Platypus, but haven't
34       used it much, generally finding function wrappers to be a more powerful
35       (although possibly not as fast) interface.  It has thus not been tested
36       as much as the rest of Platypus.  If you feel the need to use this
37       interface please coordinate with the Platypus developers.
38
39       The custom types API for FFI::Platypus allows you to set multiple C
40       arguments from a single Perl argument as a common type.  This is
41       sometimes useful for pointer / size pairs which are a common pattern in
42       C, but are usually represented by a single value (a string scalar) in
43       Perl.
44
45       The custom type API is somewhat experimental, and you should expect
46       some changes as needs arise (I won't break compatibility lightly,
47       however).
48

FUNCTIONS

50       These functions are only valid within a custom type callback.
51
52   arguments_count
53        my $count = argument_count;
54
55       Returns the total number of native arguments.
56
57   arguments_get_sint8
58        my $sint8 = arguments_get_sint8 $i;
59
60       Get the 8 bit signed integer argument from position $i.
61
62   arguments_set_sint8
63        arguments_set_sint8 $i, $sint8;
64
65       Set the 8 bit signed integer argument at position $i to $sint8.
66
67   arguments_get_uint8
68        my $uint8 = arguments_get_uint8 $i;
69
70       Get the 8 bit unsigned integer argument from position $i.
71
72   arguments_set_uint8
73        arguments_set_uint8 $i, $uint8;
74
75       Set the 8 bit unsigned integer argument at position $i to $uint8.
76
77   arguments_get_sint16
78        my $sint16 = arguments_get_sint16 $i;
79
80       Get the 16 bit signed integer argument from position $i.
81
82   arguments_set_sint16
83        arguments_set_sint16 $i, $sint16;
84
85       Set the 16 bit signed integer argument at position $i to $sint16.
86
87   arguments_get_uint16
88        my $uint16 = arguments_get_uint16 $i;
89
90       Get the 16 bit unsigned integer argument from position $i.
91
92   arguments_set_uint16
93        arguments_set_uint16 $i, $uint16;
94
95       Set the 16 bit unsigned integer argument at position $i to $uint16.
96
97   arguments_get_sint32
98        my $sint32 = arguments_get_sint32 $i;
99
100       Get the 32 bit signed integer argument from position $i.
101
102   arguments_set_sint32
103        arguments_set_sint32 $i, $sint32;
104
105       Set the 32 bit signed integer argument at position $i to $sint32.
106
107   arguments_get_uint32
108        my $uint32 = arguments_get_uint32 $i;
109
110       Get the 32 bit unsigned integer argument from position $i.
111
112   arguments_set_uint32
113        arguments_set_uint32 $i, $uint32;
114
115       Set the 32 bit unsigned integer argument at position $i to $uint32.
116
117   arguments_get_sint64
118        my $sint64 = arguments_get_sint64 $i;
119
120       Get the 64 bit signed integer argument from position $i.
121
122   arguments_set_sint64
123        arguments_set_sint64 $i, $sint64;
124
125       Set the 64 bit signed integer argument at position $i to $sint64.
126
127   arguments_get_uint64
128        my $uint64 = arguments_get_uint64 $i;
129
130       Get the 64 bit unsigned integer argument from position $i.
131
132   arguments_set_uint64
133        arguments_set_uint64 $i, $uint64;
134
135       Set the 64 bit unsigned integer argument at position $i to $uint64.
136
137   arguments_get_float
138        my $float = arguments_get_float $i;
139
140       Get the floating point argument from position $i.
141
142   arguments_set_float
143        arguments_set_float $i, $float;
144
145       Set the floating point argument at position $i to $float
146
147   arguments_get_double
148        my $double = arguments_get_double $i;
149
150       Get the double precision floating point argument from position $i.
151
152   arguments_set_double
153        arguments_set_double $i, $double;
154
155       Set the double precision floating point argument at position $i to
156       $double
157
158   arguments_get_pointer
159        my $pointer = arguments_get_pointer $i;
160
161       Get the pointer argument from position $i.
162
163   arguments_set_pointer
164        arguments_set_pointer $i, $pointer;
165
166       Set the pointer argument at position $i to $pointer.
167
168   arguments_get_string
169        my $string = arguments_get_string $i;
170
171       Get the string argument from position $i.
172
173   arguments_set_string
174        arguments_set_string $i, $string;
175
176       Set the string argument at position $i to $string.
177

SEE ALSO

179       FFI::Platypus
180
181       Examples of use:
182
183       FFI::Platypus::Type::PointerSizeBuffer
184

AUTHOR

186       Author: Graham Ollis <plicease@cpan.org>
187
188       Contributors:
189
190       Bakkiaraj Murugesan (bakkiaraj)
191
192       Dylan Cali (calid)
193
194       pipcet
195
196       Zaki Mughal (zmughal)
197
198       Fitz Elliott (felliott)
199
200       Vickenty Fesunov (vyf)
201
202       Gregor Herrmann (gregoa)
203
204       Shlomi Fish (shlomif)
205
206       Damyan Ivanov
207
208       Ilya Pavlov (Ilya33)
209
210       Petr Písař (ppisar)
211
212       Mohammad S Anwar (MANWAR)
213
214       Håkon Hægland (hakonhagland, HAKONH)
215
216       Meredith (merrilymeredith, MHOWARD)
217
218       Diab Jerius (DJERIUS)
219
220       Eric Brine (IKEGAMI)
221
222       szTheory
223
224       José Joaquín Atria (JJATRIA)
225
226       Pete Houston (openstrike, HOUSTON)
227
229       This software is copyright (c) 2015-2022 by Graham Ollis.
230
231       This is free software; you can redistribute it and/or modify it under
232       the same terms as the Perl 5 programming language system itself.
233
234
235
236perl v5.34.1                      2022-06-20             FFI::Platypus::API(3)
Impressum