Permalink
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (12 sloc) 330 Bytes
use feature 'say';
use strict;
use warnings;
use FFI::Raw;
use DynaLoader;
my $lib = DynaLoader::dl_load_file(DynaLoader::dl_findfile('-lm'));
my $fun = DynaLoader::dl_find_symbol($lib, 'fmax');
my $fmax = FFI::Raw -> new_from_ptr(
$fun, FFI::Raw::double,
FFI::Raw::double, FFI::Raw::double
);
say $fmax -> call(2.0, 4.0);