NAME FFI::TinyCC::Inline - Embed Tiny C code in your Perl program VERSION version 0.28 SYNOPSIS use FFI::TinyCC::Inline qw( tcc_inline ); tcc_inline q{ int square(int num) { return num*num; } }; print square(4), "\n"; # prints 16 use FFI::TinyCC::Inline qw( tcc_eval ); # sets value to 6: my $value = tcc_eval q{ int main(int a, int b, int c) { return a + b + c; } }, 1, 2, 3; DESCRIPTION This module provides a simplified interface to FFI::TinyCC, that allows you to write Perl subs in C. It is inspired by XS::TCC, but it uses FFI::Platypus to create bindings instead of XS. OPTIONS You can specify Tiny C options using the scoped pragmata, like so: use FFI::TinyCC::Inline options => "-I/foo/include -L/foo/lib -DFOO=1"; # prints 1 print tcc_eval q{ #include /* will search /foo/include int main() { return FOO; /* defined and set to 1 */ } }; FUNCTIONS tcc_inline tcc_inline $c_code; Compile the given C code using Tiny C and inject any functions found into the current package. An exception will be thrown if the code fails to compile, or if FFI::TinyCC::Inline does not recognize one of the argument or return types. tcc_inline q{ int foo(int a, int b, int c) { return a + b + c; } }; print foo(1,2,3), "\n"; # prints 6 The special argument type of (int argc, char **argv) is recognized and will be translated from the list of arguments passed in. Example: tcc_inline q{ void foo(int argc, const char **argv) { int i; for(i=0; i Contributors: aero Dylan Cali (calid) pipcet COPYRIGHT AND LICENSE This software is copyright (c) 2015-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.