NAME

Module::Build::FFI - Build Perl extensions if C with FFI.

VERSION

version 0.02

SYNOPSIS

raw Build.PL:

use Module::Build::FFI;
Module::Build::FFI->new(
  module_name => 'Foo::Bar',
  ...
)->create_build_script;

Dist::Zilla:

[ModuleBuild]
mb_class      = Module::Build::FFI

Put your .c and .h files in ffi (ffi/example.c):

#include <stdio.h>

void print_hello(void)
{
  printf("hello world\n");
}

Attach it in your main module:

package Foo::Bar;

use FFI::Raw;
use FFI::Util qw( locate_module_share_lib );

my $lib = locate_module_share_lib();

*print_hello = FFI::Raw->new($lib, 'hello_world', FFI::Raw::void)->coderef; 

Use it elsewhere:

use Foo::Bar;
Foo::Bar::hello_world();

DESCRIPTION

Module::Build variant for writing Perl extensions in C with FFI.

AUTHOR

Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 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.