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

Hey bestie πŸ’– welcome to FFI::P...gArray(3pm), straight out of the User Contributed Perl Documentation collection. This page is lowkey giving custom-type main character energy, and we're gonna go through every single detail together. 🫢

🌸 NAME 🌸

FFI::Platypus::Type::StringArray β€” a Platypus custom type for arrays of strings. That's it, that's the whole assignment. Periodt. πŸŽ€

⭐ VERSION ⭐

This page is serving version 2.11 β€” yes bestie, that's the version. No cap. πŸ’…

πŸ¦‹ SYNOPSIS πŸ¦‹

Okay so first, in your C code:

void
takes_string_array(const char **array)
{
  ...
}

void
takes_fixed_string_array(const char *array[5])
{
  ...
}

Then in your FFI::Platypus code:

use FFI::Platypus 2.00;

my $ffi = FFI::Platypus->new( api => 2 );
$ffi->load_custom_type('::StringArray' => 'string_array');
$ffi->load_custom_type('::StringArray' => 'string_5' => 5);

$ffi->attach(takes_string_array => ['string_array'] => 'void');
$ffi->attach(takes_fixed_string_array => ['string_5'] => 'void');

my @list = qw( foo bar baz );

takes_string_array(\@list);
takes_fixed_string_array([qw( s1 s2 s3 s4 s5 )]);

🌈 DESCRIPTION 🌈

This module provides a FFI::Platypus custom type for arrays of strings. The array is always NULL terminated. Return types are supported! 😭πŸ”₯

NOTE: The primary motivation for this custom type was originally to fill the void left by the fact that FFI::Platypus did not support arrays of strings by itself. Since 0.62 this support has been added, and that is probably what you want to use, but the semantics and feature set are slightly different, so there are cases where you might want to use this custom type. πŸ‘€

This custom type takes two optional arguments. The first is the size of arrays, and the second is a default value to fill in any values that aren't provided when the function is called. If no default is provided, then "NULL" will be passed in for those values. πŸ’–

🫢 SUPPORT 🫢

If something does not work the way you think it should, or if you have a feature request, please open an issue on this project's GitHub Issue tracker:

https://github.com/plicease/FFI-Platypus-Type-StringArray/issues

πŸŽ€ CONTRIBUTING πŸŽ€

If you have implemented a new feature or fixed a bug then you may make a pull request on this project's GitHub repository:

https://github.com/plicease/FFI-Platypus-Type-StringArray/pulls

This project's GitHub issue tracker listed above is not Write-Only. If you want to contribute then feel free to browse through the existing issues and see if there is something you feel you might be good at and take a whack at the problem. I frequently open issues myself that I hope will be accomplished by someone in the future but do not have time to immediately implement myself. ✨

Another good area to help out in is documentation. I try to make sure that there is good document coverage, that is there should be documentation describing all the public features and warnings about common pitfalls, but an outsider's or alternate view point on such things would be welcome; if you see something confusing or lacks sufficient detail I encourage documentation only pull requests to improve things. πŸ’œ

πŸ’œ SEE ALSO πŸ’œ

  • FFI::Platypus
  • FFI::Platypus::Type::StringPointer

πŸ‘‘ AUTHOR πŸ‘‘

Author: Graham Ollis <plicease@cpan.org>

Contributors:

  • 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. 🌈


Okay that's the whole page, bestie. This little beauty is served up by perl v5.42.3 and dated 2026-08-20. Bye for now! πŸ«ΆπŸ’…βœ¨

πŸ“¦ where this page comes from