Inline::Struct 0.06 review
DownloadInline::Struct is a Perl module that manipulate C structures directly from Perl. SYNOPSIS use Inline C => Config => Structs =
|
|
Inline::Struct is a Perl module that manipulate C structures directly from Perl.
SYNOPSIS
use Inline C => Config => Structs => ['Foo'];
my $obj = Inline::Struct::Foo->new;
$obj->num(10);
$obj->str("Hello");
myfunc($obj);
__END__
__C__
struct Foo {
int num;
char *str;
};
void myfunc(Foo *f) {
printf("myfunc: num=%i, str='%s'n", f->num, f->str);
}
This complete program prints:
myfunc: num=10, str='Hello'
Inline::Struct is not a new language. It's a language extension designed to be used by Inline::C. It parses struct definitions and creates typemaps and XS code which bind each struct into a Perl class. This code is passed to Inline::C, which compiles it in the normal way.
NOTE: Inline::Struct parses only C-style structs. It doesn't know about any C++ extensions to structs like scopes, constructors or methods. If you want such functionality you should use Inline::CPP to parse your structs.
Requirements:
Perl
Inline::Struct 0.06 keywords