The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

FFI::Library - Perl Access to Dynamically Loaded Libraries

VERSION

version 0.05

SYNOPSIS

 use FFI::Library;
 $lib = FFI::Library->new("mylib");
 $fn = $lib->function("fn", "signature");
 $ret = $fn->(...);

DESCRIPTION

This module provides access from Perl to functions exported from dynamically linked libraries. Functions are described by signatures, for details of which see the FFI module's documentation.

Newer and better maintained FFI modules such as FFI::Platypus provide more functionality and should probably be considered for new projects.

CONSTRUCTOR

new

 my $lib = FFI::Library->new($libname);

Creates an instance of FFI::Library.

FUNCTIONS

address

 my $address = $lib->address($function_name);

Returns the symbol of the given function. Returns undef if the symbol is not found.

function

 my $sub = $lib->function($function_name, $signature);

Creates a code-reference like object which you can call.

EXAMPLES

 $clib_file = ($^O eq "MSWin32") ? "MSVCRT40.DLL" : "-lc";
 $clib = FFI::Library->new($clib_file);
 $strlen = $clib->function("strlen", "cIp");
 $n = $strlen->($my_string);

SUPPORT

Please open any support tickets with this project's GitHub repository here:

https://github.com/Perl5-FFI/FFI/issues

SEE ALSO

FFI

Low level interface to ffcall that this module is based on

FFI::CheckLib

Portable functions for finding libraries.

FFI::Platypus

Platypus is another FFI interface based on libffi. It has a more extensive feature set, and libffi has a less restrictive license.

Win32::API

An FFI interface for Perl on Microsoft Windows.

AUTHOR

Paul Moore, <gustav@morpheus.demon.co.uk> is the original author of FFI.

Mitchell Charity <mcharity@vendian.org> contributed fixes.

Anatoly Vorobey <avorobey@pobox.com> and Gaal Yahas <gaal@forum2.org> are the current maintainers.

Graham Ollis <plicease@cpan.org is the current maintainer

LICENSE

This software is copyright (c) 1999 by Paul Moore.

This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License

AUTHOR

Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016-2018 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.