Affix
view release on metacpan or search on metacpan
my $vec_add = Affix::affix('libtest', 'add_vecs', '(v[4:float], v[4:float]) -> v[4:float]');
# Pack arguments (4 floats)
my $v1 = pack('f4', 1.0, 2.0, 3.0, 4.0);
my $v2 = pack('f4', 5.0, 5.0, 5.0, 5.0);
# Pass binary strings directly (Fast Path)
my $res_ref = $vec_add->($v1, $v2);
# Result comes back as Array Ref by default from pull_vector
use Data::Dumper;
print Dumper($res_ref); # [6.0, 7.0, 8.0, 9.0]
```
# SEE ALSO
[FFI::Platypus](https://metacpan.org/pod/FFI%3A%3APlatypus), [C::DynaLib](https://metacpan.org/pod/C%3A%3ADynaLib), [XS::TCC](https://metacpan.org/pod/XS%3A%3ATCC)
All the heavy lifting is done by **infix** ([https://github.com/sanko/infix](https://github.com/sanko/infix)).
# AUTHOR
lib/Affix.pod view on Meta::CPAN
my $vec_add = Affix::affix('libtest', 'add_vecs', '(v[4:float], v[4:float]) -> v[4:float]');
# Pack arguments (4 floats)
my $v1 = pack('f4', 1.0, 2.0, 3.0, 4.0);
my $v2 = pack('f4', 5.0, 5.0, 5.0, 5.0);
# Pass binary strings directly (Fast Path)
my $res_ref = $vec_add->($v1, $v2);
# Result comes back as Array Ref by default from pull_vector
use Data::Dumper;
print Dumper($res_ref); # [6.0, 7.0, 8.0, 9.0]
=head1 SEE ALSO
L<FFI::Platypus>, L<C::DynaLib>, L<XS::TCC>
All the heavy lifting is done by B<infix> (L<https://github.com/sanko/infix>).
=head1 AUTHOR
t/021_shakedown.t view on Meta::CPAN
use v5.40;
use lib '../lib', 'lib';
use blib;
use Test2::Tools::Affix qw[:all];
use Affix qw[:all];
use Config;
use Data::Dumper;
# ============================================================================
# C Source Code Definition
# ============================================================================
my $c_source = <<'END_C';
#include "std.h"
//ext: .c
#include <stdint.h>
#include <stdbool.h>
( run in 0.682 second using v1.01-cache-2.11-cpan-6c8682c6c89 )