File: array_sum.pl

package info (click to toggle)
libffi-platypus-perl 2.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,860 kB
  • sloc: perl: 7,388; ansic: 6,862; cpp: 53; sh: 19; makefile: 14
file content (14 lines) | stat: -rw-r--r-- 288 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use strict;
use warnings;
use FFI::Platypus 2.00;

my $ffi = FFI::Platypus->new(
  api => 2,
  lib => './array_sum.so',
);

$ffi->attach( array_sum => ['int*'] => 'int' );

print array_sum(undef), "\n";     # -1
print array_sum([0]), "\n";       # 0
print array_sum([1,2,3,0]), "\n"; # 6