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 1.43
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;
29
30 my $ffi = FFI::Platypus->new( api => 1 );
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 Pisar (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
99 This software is copyright (c) 2015,2016,2017,2018,2019,2020 by Graham
100 Ollis.
101
102 This is free software; you can redistribute it and/or modify it under
103 the same terms as the Perl 5 programming language system itself.
104
105
106
107perl v5.32.1 2021-03-F1F8I::Platypus::Type::StringPointer(3)