FFI::P...s::API(3pm)
๐ธ NAME ๐ธ
okay so bestie, this is FFI::Platypus::API โ the Platypus arguments and return value API for custom types. The manual page is filed under the very glamorously truncated name FFI::P...s::API(3pm) and it's part of User Contributed Perl Documentation. Come sit with me, we're gonna make custom types make sense ๐
๐ VERSION ๐
version 2.11 โ that's the vibe check, bestie โจ
โจ SYNOPSIS โจ
okay so here's the whole custom type moment in code, exactly as it appears, no edits, periodt:
package FFI::Platypus::Type::MyCustomType;
use FFI::Platypus::API;
sub ffi_custom_type_api_1
{
{
native_type => 'uint32',
perl_to_native => sub {
my($value, $i) = @_;
# Translates ($value) passed in from Perl
# into ($value+1, $value+2)
arguments_set_uint32($i, $value+1);
arguments_set_uint32($i+1, $value+2);
},
argument_count => 2,
}
}
๐ฆ DESCRIPTION ๐ฆ
NOTE: I added this interface early on to FFI::Platypus, but haven't used it much, generally finding function wrappers to be a more powerful (although possibly not as fast) interface. It has thus not been tested as much as the rest of Platypus. If you feel the need to use this interface please coordinate with the Platypus developers.
Real talk, bestie: the custom types API for FFI::Platypus lets you set multiple C arguments from a single Perl argument as a common type. This is sometimes useful for pointer / size pairs which are a common pattern in C, but are usually represented by a single value (a string scalar) in Perl.
Also, heads up: the custom type API is somewhat experimental, and you should expect some changes as needs arise (I won't break compatibility lightly, however). No cap, it's giving experimental but also kind of iconic.
๐ FUNCTIONS ๐
These functions are only valid within a custom type callback โ like, don't try to call them at brunch, okay? ๐
๐งฎ arguments_count
my $count = argument_count;
Returns the total number of native arguments โ the whole squad count, fr.
๐ข arguments_get_sint8
my $sint8 = arguments_get_sint8 $i;
Grabs the 8 bit signed integer argument from position $i, bestie.
๐ ๏ธ arguments_set_sint8
arguments_set_sint8 $i, $sint8;
Sets the 8 bit signed integer argument at position $i to $sint8 โ slay.
๐ข arguments_get_uint8
my $uint8 = arguments_get_uint8 $i;
Grabs the 8 bit unsigned integer argument from position $i.
๐ ๏ธ arguments_set_uint8
arguments_set_uint8 $i, $uint8;
Sets the 8 bit unsigned integer argument at position $i to $uint8.
๐ข arguments_get_sint16
my $sint16 = arguments_get_sint16 $i;
Grabs the 16 bit signed integer argument from position $i.
๐ ๏ธ arguments_set_sint16
arguments_set_sint16 $i, $sint16;
Sets the 16 bit signed integer argument at position $i to $sint16.
๐ข arguments_get_uint16
my $uint16 = arguments_get_uint16 $i;
Grabs the 16 bit unsigned integer argument from position $i.
๐ ๏ธ arguments_set_uint16
arguments_set_uint16 $i, $uint16;
Sets the 16 bit unsigned integer argument at position $i to $uint16.
๐ข arguments_get_sint32
my $sint32 = arguments_get_sint32 $i;
Grabs the 32 bit signed integer argument from position $i.
๐ ๏ธ arguments_set_sint32
arguments_set_sint32 $i, $sint32;
Sets the 32 bit signed integer argument at position $i to $sint32.
๐ข arguments_get_uint32
my $uint32 = arguments_get_uint32 $i;
Grabs the 32 bit unsigned integer argument from position $i.
๐ ๏ธ arguments_set_uint32
arguments_set_uint32 $i, $uint32;
Sets the 32 bit unsigned integer argument at position $i to $uint32.
๐ข arguments_get_sint64
my $sint64 = arguments_get_sint64 $i;
Grabs the 64 bit signed integer argument from position $i.
๐ ๏ธ arguments_set_sint64
arguments_set_sint64 $i, $sint64;
Sets the 64 bit signed integer argument at position $i to $sint64.
๐ข arguments_get_uint64
my $uint64 = arguments_get_uint64 $i;
Grabs the 64 bit unsigned integer argument from position $i.
๐ ๏ธ arguments_set_uint64
arguments_set_uint64 $i, $uint64;
Sets the 64 bit unsigned integer argument at position $i to $uint64.
๐ข arguments_get_float
my $float = arguments_get_float $i;
Grabs the floating point argument from position $i.
๐ ๏ธ arguments_set_float
arguments_set_float $i, $float;
Sets the floating point argument at position $i to $float โ periodt.
๐ข arguments_get_double
my $double = arguments_get_double $i;
Grabs the double precision floating point argument from position $i.
๐ ๏ธ arguments_set_double
arguments_set_double $i, $double;
Sets the double precision floating point argument at position $i to $double.
๐ข arguments_get_pointer
my $pointer = arguments_get_pointer $i;
Grabs the pointer argument from position $i.
๐ ๏ธ arguments_set_pointer
arguments_set_pointer $i, $pointer;
Sets the pointer argument at position $i to $pointer.
๐ข arguments_get_string
my $string = arguments_get_string $i;
Grabs the string argument from position $i.
๐ ๏ธ arguments_set_string
arguments_set_string $i, $string;
Sets the string argument at position $i to $string.
๐ SEE ALSO ๐
- Main character energy:
FFI::Platypus๐ - Examples of use:
FFI::Platypus::Type::PointerSizeBufferโจ
๐ AUTHOR ๐
Author: Graham Ollis <plicease@cpan.org> โ icon, legend, the moment.
Contributors, in the original order:
- 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)
๐ COPYRIGHT AND LICENSE ๐
This software is copyright (c) 2015-2022 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
okay bye bestie ๐ this page was rendered with perl v5.42.3, dated 2026-08-20, for the FFI::P...s::API(3pm) manual โ slay and stay safe ๐ซถ
๐ฆ where this page comes from
- ubuntu stonking: libffi-platypus-perl 2.11-1build1 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms