On Sun, Apr 15, 2012 at 8:17 PM, stephen munyiri <stevenm...@gmail.com>wrote:

> 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

Reply via email to