Scroll to navigation

FFI::Platypus::Type::StringPointer(3pm) User Contributed Perl Documentation FFI::Platypus::Type::StringPointer(3pm)

NAME

FFI::Platypus::Type::StringPointer - Convert a pointer to a string and back

VERSION

version 0.83

SYNOPSIS

In your C code:

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

In your Platypus::FFI code:

 use FFI::Platypus;
 
 my $ffi = FFI::Platypus->new;
 $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

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.

This module provides a FFI::Platypus custom type for pointers to strings.

SEE ALSO

FFI::Platypus
Main Platypus documentation.
FFI::Platypus::Type
Platypus types documentation.

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)

COPYRIGHT AND LICENSE

This software is copyright (c) 2015,2016,2017,2018,2019 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.

2019-02-13 perl v5.28.1