1FFI::Platypus::Type::StUrsienrgPCooinnttreirb(u3t)ed PerFlFID:o:cPulmaetnytpautsi:o:nType::StringPointer(3)
2
3
4
6 FFI::Platypus::Type::StringPointer - Convert a pointer to a string and
7 back
8
10 version 2.08
11
13 In your C code:
14
15 void
16 string_pointer_argument(const char **string)
17 {
18 ...
19 }
20 const char **
21 string_pointer_return(void)
22 {
23 ...
24 }
25
26 In your Platypus::FFI code:
27
28 use FFI::Platypus 2.00;
29
30 my $ffi = FFI::Platypus->new( api => 2 );
31 $ffi->load_custom_type('::StringPointer' => 'string_pointer');
32
33 $ffi->attach(string_pointer_argument => ['string_pointer'] => 'void');
34 $ffi->attach(string_pointer_return => [] => 'string_pointer');
35
36 my $string = "foo";
37
38 string_pointer_argument(\$string); # $string may be modified
39
40 $ref = string_pointer_return();
41
42 print $$ref; # print the string pointed to by $ref
43
45 NOTE: As of version 0.61, this custom type is now deprecated since
46 pointers to strings are supported in the FFI::Platypus directly without
47 custom types.
48
49 This module provides a FFI::Platypus custom type for pointers to
50 strings.
51
53 FFI::Platypus
54 Main Platypus documentation.
55
56 FFI::Platypus::Type
57 Platypus types documentation.
58
60 Author: Graham Ollis <plicease@cpan.org>
61
62 Contributors:
63
64 Bakkiaraj Murugesan (bakkiaraj)
65
66 Dylan Cali (calid)
67
68 pipcet
69
70 Zaki Mughal (zmughal)
71
72 Fitz Elliott (felliott)
73
74 Vickenty Fesunov (vyf)
75
76 Gregor Herrmann (gregoa)
77
78 Shlomi Fish (shlomif)
79
80 Damyan Ivanov
81
82 Ilya Pavlov (Ilya33)
83
84 Petr Písař (ppisar)
85
86 Mohammad S Anwar (MANWAR)
87
88 Håkon Hægland (hakonhagland, HAKONH)
89
90 Meredith (merrilymeredith, MHOWARD)
91
92 Diab Jerius (DJERIUS)
93
94 Eric Brine (IKEGAMI)
95
96 szTheory
97
98 José Joaquín Atria (JJATRIA)
99
100 Pete Houston (openstrike, HOUSTON)
101
103 This software is copyright (c) 2015-2022 by Graham Ollis.
104
105 This is free software; you can redistribute it and/or modify it under
106 the same terms as the Perl 5 programming language system itself.
107
108
109
110perl v5.36.1 2023-05-F1F5I::Platypus::Type::StringPointer(3)