Discussion:
inline::cpp objects, arrays, hashes
stephen munyiri
2012-04-16 01:17:09 UTC
Permalink
Hi,

Do you have examples of how you can call C++ functions from perl that
return objects(or references), arrays, hashes.
Just wanna know how inline::cpp can work with objects and how to call
functions of those objects.
I'm also curious how inline can work with data structures.

Thanks,
Steven.
David Mertens
2012-04-17 15:08:56 UTC
Permalink
Post by stephen munyiri
Hi,
Do you have examples of how you can call C++ functions from perl that
return objects(or references), arrays, hashes.
Just wanna know how inline::cpp can work with objects and how to call
functions of those objects.
I'm also curious how inline can work with data structures.
Thanks,
Steven.
Steven,

For handling C++ objects, check the examples in the documentation:
p3rl.org/Inline::CPP.

For handling arrays, hashes, and other Perl variables, you will need to use
Perl's C API. I must confess that it took me quite a bit of effort to get
the hang of Perl's C API and the few tutorials that exist are targeted to
users of XS. For the Inline::C (and CPP) perspective, see
https://metacpan.org/module/Inline::C-Cookbook#Meat-Potatoes. The reference
document for the Perl API is here: http://perldoc.perl.org/perlapi.html.

David
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." -- Brian Kernighan
Loading...