| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
use FFI::Platypus 2.00; |
| 4 |
|
| 5 |
my $ffi = FFI::Platypus->new( |
| 6 |
api => 2, |
| 7 |
lib => './swap.so', |
| 8 |
); |
| 9 |
|
| 10 |
$ffi->attach( swap => ['int*','int*'] ); |
| 11 |
|
| 12 |
my $a = 1; |
| 13 |
my $b = 2; |
| 14 |
|
| 15 |
print "[a,b] = [$a,$b]\n"; |
| 16 |
|
| 17 |
swap( \$a, \$b ); |
| 18 |
|
| 19 |
print "[a,b] = [$a,$b]\n"; |