FFI::P...ersion0(3pm)

πŸ’… NAME πŸ’…

FFI::Platypus::TypeParser::Version0 β€” the OG FFI Type Parser, Version Zero, the blueprint, the original recipe 🧚

(also hi bestie, this is a User Contributed Perl Documentation page, so like… respect the elders ok πŸ’–)


✨ VERSION ✨

version 2.11 πŸŽ€


🫢 SYNOPSIS 🫢

use FFI::Platypus;
my $ffi = FFI::Platypus->new( api => 0 );
$ffi->type('record(Foo::Bar)' => 'foo_bar_t');
$ffi->type('opaque' => 'baz_t');
$ffi->type('opaque*' => 'baz_ptr');

like literally just vibe with api => 0 and you're in the version-zero cinematic universe 🌈


🌸 DESCRIPTION 🌸

okay so this page documents the original FFI::Platypus type parser β€” the one that was the default and the only type parser used by FFI::Platypus starting with version 0.02. she's the firstborn, the main character of the early days πŸ‘‘

then starting with version 1.00, FFI::Platypus comes with a new type parser that has design fixes which are not backward compatible. not a glow-up, an actual rewrite πŸ’€

πŸ¦‹ Interface differences πŸ¦‹

πŸ’€ Pass-by-value records are not allowed

Originally FFI::Platypus only supported passing records as a pointer. So the type record(Foo::Bar) actually passes a pointer to the record. periodt.

in the version 1.00 parser, record(Foo::Bar) is allowed and it's pass-by-value (the contents of the record is copied onto the stack), and "record(Foo::Bar)*" is pass-by-reference or pointer (a pointer to the record is passed to the callee so that it can make modifications to the record).

TL;DR: record(Foo::Bar) in version 0 is equivalent to "record(Foo::Bar)*" in the version 1 API. There is no equivalent to "record(Foo::Bar)*" in the version 0 API. not me crying about missing features 😭

πŸŽ€ decorate aliases of basic types

This is not allowed in the version 0 API:

$ffi->type('opaque' => 'foo_t');    # ok!
$ffi->type('foo_t*' => 'foo_ptr');  # not ok! in version 0, ok! in version 1

Instead you need to use the basic type in the second type definition:

$ffi->type('opaque' => 'foo_t');    # ok!
$ffi->type('opaque*' => 'foo_ptr'); # ok!

like yeah, you have to say the basic type again. the alias doesn't get to wear the little * accessory, sorry bestie πŸ™ˆ

πŸ‘‘ object types are not allowed

$ffi->type('object(Foo::Bar)');   # not ok! in version 0, ok! in version 1

nope. not a thing here. version 1 said "new object type just dropped" and version 0 said "never heard of her" πŸ’…


πŸ”₯ SEE ALSO πŸ”₯

  • FFI::Platypus β€” the core FFI::Platypus documentation, the mothership, the blueprint fr fr
  • FFI::Platypus::TypeParser::Version1 β€” the API 1.00 type parser, the newer sibling who fixed the design πŸ¦‹

πŸ’– AUTHOR πŸ’–

Author: Graham Ollis <plicease@cpan.org>

Contributors β€” the whole squad, the group chat of legends 🫢:

  • 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)

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.

bestie this is free software β€” redistribute and/or modify under the same terms as the Perl 5 programming language system itself. iconic licensing behavior, no cap πŸ’œ

and that's the page!! brought to you by perl v5.42.3, dated 2026-08-20, a User Contributed Perl Documentation moment πŸŽ€βœ¨ bye bestie, go parse some types πŸ’…

πŸ“¦ where this page comes from