Skip to content

Instantly share code, notes, and snippets.

@plicease
Last active August 29, 2015 14:18
Show Gist options
  • Save plicease/61301c8c3c2039b85a85 to your computer and use it in GitHub Desktop.
Save plicease/61301c8c3c2039b85a85 to your computer and use it in GitHub Desktop.
use FFI::Platypus;
my $ffi = FFI::Platypus( lang => 'Rust', lib => './libpoints.so' );
$ffi->type( opaque => 'Point');
$ffi->attach( make_point => [ 'i32', 'i32' ] => 'Point' );
$ffi->attach( get_distance => [ 'Point', 'Point'] => 'f64' );
say get_distance(make_point(2,2), make_point(4,4));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment