examples/bundle-foo/lib/Foo.pm
raw| 1 | package Foo; |
| 2 | |
| 3 | use strict; |
| 4 | use warnings; |
| 5 | use FFI::Platypus 2.00; |
| 6 | |
| 7 | my $ffi = FFI::Platypus->new( api => 2 ); |
| 8 | |
| 9 | $ffi->type('object(Foo)' => 'foo_t'); |
| 10 | $ffi->mangler(sub { |
| 11 | my $name = shift; |
| 12 | $name =~ s/^/foo__/; |
| 13 | $name; |
| 14 | }); |
| 15 | |
| 16 | $ffi->bundle; |
| 17 | |
| 18 | $ffi->attach( new => [ 'string', 'string', 'int' ] => 'foo_t' ); |
| 19 | $ffi->attach( name => [ 'foo_t' ] => 'string' ); |
| 20 | $ffi->attach( value => [ 'foo_t' ] => 'int' ); |
| 21 | $ffi->attach( DESTROY => [ 'foo_t' ] => 'void' ); |
| 22 | |
| 23 | 1; |