Dave Cross: Still Munging Data With Perl: Online event - Mar 17 Learn more

NAME

Devel::BindPP - bind c++ to perl

SYNOPSIS

// generate ppport.h & bindpp.h
perl -e 'use Devel::BindPP; Devel::BindPP::WriteFile()'
//// and write your c++ module
#include "bindpp.h"
XS(xs_new) {
pl::Ctx c;
char *self;
Newx(self, 3, char);
strcpy(self, "ok");
pl::Pointer obj((void*)self, "MyOwnExt");
c.ret(&obj);
}
XS(xs_get) {
pl::Ctx c;
pl::Pointer * p = c.arg(0)->as_pointer();
char *self = p->extract<char>();
c.ret(self);
}
XS(xs_destroy) {
pl::Ctx c;
pl::Pointer * p = c.arg(0)->as_pointer();
Safefree(p->extract<char>());
c.return_true();
}
extern "C" {
XS(bootstrap_Your__Package) {
pl::BootstrapCtx bc;
pl::Package pkg("MyOwnExt");
pkg.add_method("new", xs_new, __FILE__);
pkg.add_method("get", xs_get, __FILE__);
pkg.add_method("DESTROY", xs_destroy, __FILE__);
}
};

CAUTION

THIS MODULE IS ITS IN BETA QUALITY. API MAY CHANGE IN THE FUTURE.

DESCRIPTION

XS is too difficult for me :p XS is filled by too much C macros.

You can write perl extension by pure C++ with Devel::BindPP.

This module contains only one header file.You can include this file and write C++!

manual file generated by doxygen is here: http://tokuhirom.github.com/devel-bindpp/hierarchy.html

NOTE

bindpp.h defines a lot of macros(provided by perl.h).In sometime, Macros break your code.

If you have a error.Please try the #include <bindpp.h> put last of your #include lines.

REPOSITORY

github.com:tokuhirom/devel-bindpp.git

AUTHOR

Tokuhiro Matsuno <tokuhirom ah! gmail.com>

THANKS TO

mattn++ # win32 port

SEE ALSO

Devel::PPPort, perl

LICENSE

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