| 1 | package FFI::Raw::Callback; | ||
| 2 | 1 | $FFI::Raw::Callback::VERSION = '0.32'; | |
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | FFI::Raw::Callback - FFI::Raw function pointer type | ||
| 9 | |||
| 10 | =head1 VERSION | ||
| 11 | |||
| 12 | version 0.32 | ||
| 13 | |||
| 14 | =head1 DESCRIPTION | ||
| 15 | |||
| 16 | A B<FFI::Raw::Callback> represents a function pointer to a Perl routine. It can | ||
| 17 | be passed to functions taking a C<FFI::Raw::ptr> type. | ||
| 18 | |||
| 19 | =head1 METHODS | ||
| 20 | |||
| 21 | =head2 new( $coderef, $ret_type [, $arg_type ...] ) | ||
| 22 | |||
| 23 | Create a C<FFI::Raw::Callback> using the code reference C<$coderef> as body. The | ||
| 24 | signature (return and arguments types) must also be passed. | ||
| 25 | |||
| 26 | =head1 CAVEATS | ||
| 27 | |||
| 28 | For callbacks with a C<FFI::Raw::str> return type, the string value will be copied | ||
| 29 | to a private field on the callback object. The memory for this value will be | ||
| 30 | freed the next time the callback is called, or when the callback itself is freed. | ||
| 31 | For more exact control over when the return value is freed, you can instead | ||
| 32 | use C<FFI::Raw::ptr> type and return a L<FFI::Raw::MemPtr> object. | ||
| 33 | |||
| 34 | =head1 AUTHOR | ||
| 35 | |||
| 36 | Alessandro Ghedini <alexbio@cpan.org> | ||
| 37 | |||
| 38 | =head1 LICENSE AND COPYRIGHT | ||
| 39 | |||
| 40 | Copyright 2013 Alessandro Ghedini. | ||
| 41 | |||
| 42 | This program is free software; you can redistribute it and/or modify it | ||
| 43 | under the terms of either: the GNU General Public License as published | ||
| 44 | by the Free Software Foundation; or the Artistic License. | ||
| 45 | |||
| 46 | See http://dev.perl.org/licenses/ for more information. | ||
| 47 | |||
| 48 | =cut | ||
| 49 | |||
| 50 | 1 | 1; # End of FFI::Raw::Callback | |