examples/math.pl
raw| 1 | use strict; |
| 2 | use warnings; |
| 3 | use FFI::Platypus 2.00; |
| 4 | use FFI::CheckLib; |
| 5 | |
| 6 | my $ffi = FFI::Platypus->new( api => 2 ); |
| 7 | $ffi->lib(undef); |
| 8 | $ffi->attach(puts => ['string'] => 'int'); |
| 9 | $ffi->attach(fdim => ['double','double'] => 'double'); |
| 10 | |
| 11 | puts(fdim(7.0, 2.0)); |
| 12 | |
| 13 | $ffi->attach(cos => ['double'] => 'double'); |
| 14 | |
| 15 | puts(cos(2.0)); |
| 16 | |
| 17 | $ffi->attach(fmax => ['double', 'double'] => 'double'); |
| 18 | |
| 19 | puts(fmax(2.0,3.0)); |