Install Perl (probably already installed):
Need to install the FFI::Raw module:sudo apt-get install perl
Run itsudo perl -MCPAN -e 'install FFI::Raw'
or (if it's executable)perl main.pl
./main.pl
Output:#!/usr/bin/perl use strict; use FFI::Raw; my $add = FFI::Raw->new( './libhello.so', 'add', FFI::Raw::int, # return type FFI::Raw::int, # first arg type FFI::Raw::int # second arg type ); my $printme = FFI::Raw->new( './libhello.so', 'printme', FFI::Raw::void, # return type FFI::Raw::str # arg type ); print "The result is " . $add->call(1, 2) . "\n"; print $printme->call("Hello from Perl!");
The result is: 3 Hello from library: Hello from Perl!