NAME
FFI::Raw::Ptr - Base FFI::Raw pointer type
VERSION
version 0.32
SYNOPSIS
package Foo;
use FFI::Raw;
use base qw(FFI::Raw::Ptr);
*_foo_new = FFI::Raw -> new(
$shared, 'foo_new',
FFI::Raw::ptr
) -> coderef;
sub new {
bless shift -> SUPER::new(_foo_new());
}
*get_bar = FFI::Raw -> new(
$shared, 'foo_get_bar',
FFI::Raw::int,
FFI::Raw::ptr
) -> coderef;
*set_bar = FFI::Raw -> new(
$shared, 'foo_set_bar',
FFI::Raw::void,
FFI::Raw::ptr,
FFI::Raw::int
) -> coderef;
*DESTROY = FFI::Raw -> new(
$shared, 'foo_free',
FFI::Raw::void,
FFI::Raw::ptr
) -> coderef;
1;
package main;
my $foo = Foo -> new;
$foo -> set_bar(42);
DESCRIPTION
A FFI::Raw::Ptr represents a pointer to memory which can be passed to functions taking a FFI::Raw::ptr
argument.
Note that differently from FFI::Raw::MemPtr, FFI::Raw::Ptr
pointers are not automatically deallocated once not in use anymore.
METHODS
new( $ptr )
Create a new FFI::Raw::Ptr
pointing to $ptr
, which can be either a FFI::Raw::MemPtr
or a pointer returned by a C function.
AUTHOR
Graham Ollis <plicease@cpan.org>
Alessandro Ghedini <alexbio@cpan.org>
LICENSE AND COPYRIGHT
Copyright 2014 Alessandro Ghedini.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.