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

πŸ¦‹ FFI::Platypus::Type::StringPointer β€” a whole vibe (perl 3pm, User Contributed Perl Documentation) πŸ¦‹

okay so bestie, welcome to the manual page for FFI::Platypus::Type::StringPointer. yes the header truncates it to FFI::P...ointer(3pm) which is giving "my name is too long for the tab bar" energy, but we move. this is a User Contributed Perl Documentation page, and it's literally all about converting a pointer to a string and back. πŸŽ€


✨ NAME ✨

FFI::Platypus::Type::StringPointer β€” Convert a pointer to a string and back. that's it, that's the whole job, and it does it slayfully. πŸ’…

πŸ’– VERSION πŸ’–

version 2.11. noted. remember it for the quiz. ✨

🌸 SYNOPSIS 🌸

okay so first, in your C code, it's giving very much this:

void
string_pointer_argument(const char **string)
{
  ...
}
const char **
string_pointer_return(void)
{
  ...
}

and then in your Platypus::FFI code, you do the cute little setup:

use FFI::Platypus 2.00;

my $ffi = FFI::Platypus->new( api => 2 );
$ffi->load_custom_type('::StringPointer' => 'string_pointer');

$ffi->attach(string_pointer_argument => ['string_pointer'] => 'void');
$ffi->attach(string_pointer_return   => [] => 'string_pointer');

my $string = "foo";

string_pointer_argument(\$string); # $string may be modified

$ref = string_pointer_return();

print $$ref;  # print the string pointed to by $ref

so yes, you pass a ref to your string, it may get modified (watch it πŸ‘€), and on the way back you get a ref and you deref it with $$ref to print the string pointed to by $ref. iconic behavior honestly. 🫢

🧚 DESCRIPTION 🧚

⚠️ NOTE: As of version 0.61, this custom type is now deprecated since pointers to strings are supported in the FFI::Platypus directly without custom types.

ok so lowkey important: this thing still works, but it's deprecated, bestie. FFI::Platypus handles pointers to strings directly now, no custom type needed. (this is the "we love you but please use the new thing" era. 😭)

that said β€” what is it? this module provides a FFI::Platypus custom type for pointers to strings. simple. clean. main character energy. πŸ‘‘

🌈 SEE ALSO 🌈

  • FFI::Platypus β€” Main Platypus documentation. the big one. the mothership. go here first fr fr. πŸš€
  • FFI::Platypus::Type β€” Platypus types documentation. all the type lore you could ever want. πŸ’œ

πŸ‘‘ AUTHOR πŸ‘‘

Author: Graham Ollis <plicease@cpan.org> β€” absolute legend, no cap. πŸ’–

Contributors (a whole squad, a full roster, we stan every single one):

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

like, that's a group chat and a half. 😭✨

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. so yes, go off, remix it, share it, it's free software. πŸ¦‹


okay and for the little sign-off: this whole page came from perl v5.42.3 and it's dated 2026-08-20, so if you're reading it in the future β€” hi, bestie, you're exactly on time. πŸ’…βœ¨πŸŒΈ

source/version deets: perl v5.42.3, 2026-08-20. mwah. πŸ’–

πŸ“¦ where this page comes from