🌻 📖 Test2::Tools::FFI

NAME

Test2::Tools::FFI - Tools for testing FFI

VERSION

version 0.06

SYNOPSIS

In your t/ffi/test.c:

 int
 mytest()
 {
   return 42;
 }

In your t/mytest.t:

 use Test2::V0;
 use Test2::Tools::FFI;

 is(
   ffi->test->function( mytest => [] => 'int')->call,
   42,
 );
 
 done_testing;

DESCRIPTION

This Test2 Tools module provide some basic tools for testing FFI modules.

FUNCTIONS

ffi_options

 ffi_options %options;

This must be run before any ffi-> functions. Options available:

api

The FFI::Platypus api level. Zero (0) by default for backward compat, but it is recommended that you use One (1).

ffi->runtime

 my $ffi = ffi->runtime;

Returns a FFI::Platypus instance connected to the runtime for your module.

ffi->test

 my $ffi = ffi->test;

Returns a FFI::Platypus instance connected to the test for your module.

ffi->combined

 my $ffi = ffi->combined;

Return a FFI::Platypus instance with the combined test and runtime libraries for your module.

AUTHOR

Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE

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