FFI::Platypus::Legacy::Raw::Ptr - Base FFI::Platypus::Legacy::Raw pointer type
version 0.06
package Foo; use FFI::Platypus::Legacy::Raw; use base qw(FFI::Platypus::Legacy::Raw::Ptr); *_foo_new = FFI::Platypus::Legacy::Raw->new( $shared, 'foo_new', FFI::Platypus::Legacy::Raw::ptr )->coderef; sub new { bless shift->SUPER::new(_foo_new()); } *get_bar = FFI::Platypus::Legacy::Raw->new( $shared, 'foo_get_bar', FFI::Platypus::Legacy::Raw::int, FFI::Platypus::Legacy::Raw::ptr )->coderef; *set_bar = FFI::Platypus::Legacy::Raw->new( $shared, 'foo_set_bar', FFI::Platypus::Legacy::Raw::void, FFI::Platypus::Legacy::Raw::ptr, FFI::Platypus::Legacy::Raw::int )->coderef; *DESTROY = FFI::Platypus::Legacy::Raw->new( $shared, 'foo_free', FFI::Platypus::Legacy::Raw::void, FFI::Platypus::Legacy::Raw::ptr )->coderef; 1; package main; my $foo = Foo->new; $foo->set_bar(42);
FFI::Platypus::Legacy::Raw and friends are a fork of FFI::Raw that uses FFI::Platypus instead of FFI::Raw's own libffi implementation. It is intended for use when migrating from FFI::Raw to FFI::Platypus. The main reason one might have for switching from Raw to Platypus is because Platypus is actively maintained, provides a more powerful interface, can be much faster when functions are "attached", and works on more platforms than Raw. This module should be a drop in replacement for FFI::Raw, simply replace all instances of FFI::Raw
to FFI::Platypus::Legacy::Raw
. See also Alt::FFI::Raw::Platypus for a way to use this module without making any source code changes.
A FFI::Platypus::Legacy::Raw::Ptr represents a pointer to memory which can be passed to functions taking a FFI::Platypus::Legacy::Raw::ptr
argument.
Note that differently from FFI::Platypus::Legacy::Raw::MemPtr, FFI::Platypus::Legacy::Raw::Ptr
pointers are not automatically deallocated once not in use anymore.
my $ptr = FFI::Platypus::Legacy::Raw::Ptr->new( $ptr );
Create a new FFI::Platypus::Legacy::Raw::Ptr
pointing to $ptr
, which can be either a FFI::Platypus::Legacy::Raw::MemPtr
or a pointer returned by a C function.
Original author: Alessandro Ghedini (ghedo, ALEXBIO)
Current maintainer: Graham Ollis <plicease@cpan.org>
Contributors:
Bakkiaraj Murugesan (bakkiaraj)
Dylan Cali (CALID)
Brian Wightman (MidLifeXis, MLX)
David Steinbrunner (dsteinbrunner)
Olivier Mengué (DOLMEN)
This software is copyright (c) 2012 by Alessandro Ghedini.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.