1FFI::Platypus::Type::StUrsienrgACrornatyr(i3b)uted PerlFDFoIc:u:mPelnattaytpiuosn::Type::StringArray(3)
2
3
4
6 FFI::Platypus::Type::StringArray - Platypus custom type for arrays of
7 strings
8
10 version 1.32
11
13 In your C code:
14
15 void
16 takes_string_array(const char **array)
17 {
18 ...
19 }
20
21 void
22 takes_fixed_string_array(const char *array[5])
23 {
24 ...
25 }
26
27 In your Platypus::FFI code:
28
29 use FFI::Platypus;
30
31 my $ffi = FFI::Platypus->new( api => 1 );
32 $ffi->load_custom_type('::StringArray' => 'string_array');
33 $ffi->load_custom_type('::StringArray' => 'string_5' => 5);
34
35 $ffi->attach(takes_string_array => ['string_array'] => 'void');
36 $ffi->attach(takes_fixed_string_array => ['string_5'] => 'void');
37
38 my @list = qw( foo bar baz );
39
40 takes_string_array(\@list);
41 takes_fixed_string_array([qw( s1 s2 s3 s4 s5 )]);
42
44 NOTE: The primary motivation for this custom type was originally to
45 fill the void left by the fact that FFI::Platypus did not support
46 arrays of strings by itself. Since 0.62 this support has been added,
47 and that is probably what you want to use, but the semantics and
48 feature set are slightly different, so there are cases where you might
49 want to use this custom type.
50
51 This module provides a FFI::Platypus custom type for arrays of strings.
52 The array is always NULL terminated. Return types are supported!
53
54 This custom type takes two optional arguments. The first is the size
55 of arrays and the second is a default value to fill in any values that
56 aren't provided when the function is called. If not default is
57 provided then "NULL" will be passed in for those values.
58
60 If something does not work the way you think it should, or if you have
61 a feature request, please open an issue on this project's GitHub Issue
62 tracker:
63
64 <https://github.com/plicease/FFI-Platypus-Type-StringArray/issues>
65
67 If you have implemented a new feature or fixed a bug then you may make
68 a pull request on this project's GitHub repository:
69
70 <https://github.com/plicease/FFI-Platypus-Type-StringArray/pulls>
71
72 This project's GitHub issue tracker listed above is not Write-Only. If
73 you want to contribute then feel free to browse through the existing
74 issues and see if there is something you feel you might be good at and
75 take a whack at the problem. I frequently open issues myself that I
76 hope will be accomplished by someone in the future but do not have time
77 to immediately implement myself.
78
79 Another good area to help out in is documentation. I try to make sure
80 that there is good document coverage, that is there should be
81 documentation describing all the public features and warnings about
82 common pitfalls, but an outsider's or alternate view point on such
83 things would be welcome; if you see something confusing or lacks
84 sufficient detail I encourage documentation only pull requests to
85 improve things.
86
88 FFI::Platypus
89 FFI::Platypus::Type::StringPointer
90
92 Author: Graham Ollis <plicease@cpan.org>
93
94 Contributors:
95
96 Bakkiaraj Murugesan (bakkiaraj)
97
98 Dylan Cali (calid)
99
100 pipcet
101
102 Zaki Mughal (zmughal)
103
104 Fitz Elliott (felliott)
105
106 Vickenty Fesunov (vyf)
107
108 Gregor Herrmann (gregoa)
109
110 Shlomi Fish (shlomif)
111
112 Damyan Ivanov
113
114 Ilya Pavlov (Ilya33)
115
116 Petr Pisar (ppisar)
117
118 Mohammad S Anwar (MANWAR)
119
120 Håkon Hægland (hakonhagland, HAKONH)
121
122 Meredith (merrilymeredith, MHOWARD)
123
124 Diab Jerius (DJERIUS)
125
127 This software is copyright (c) 2015,2016,2017,2018,2019,2020 by Graham
128 Ollis.
129
130 This is free software; you can redistribute it and/or modify it under
131 the same terms as the Perl 5 programming language system itself.
132
133
134
135perl v5.32.0 2020-09-21FFI::Platypus::Type::StringArray(3)