Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^5: About using rperl

by hakonhagland (Scribe)
on Aug 14, 2019 at 13:20 UTC ( #11104449=note: print w/replies, xml ) Need Help??


in reply to Re^4: About using rperl
in thread About using rperl

Interesting, so instead of converting the Perl code to a shared library, one could convert it to a .cpp source file instead which is then included into the main Perl script using gcc and Inline::CPP ? Alternatively, write a wrapper .cpp file that links with the generated shared library by giving a libs parameter to Inline::CPP ? It would still be great if someone could present a simple working (tutorial-type) example.. :)

Replies are listed 'Best First'.
Re^6: About using rperl
by Anonymous Monk on Aug 15, 2019 at 06:56 UTC

    What?

    Inline::CPP writes xs modules for you , so you can call cpp functions from external cpp libraries without learning much xs

    It comes with "tutorial"

    RPerl converts Perl 5 source code into C++ source code

    RPerl then converts the c++ code it created from perl 5 source code, into xs module, using Inline::CPP

    There is no tutorial for explaining the RPerl way of wrapping an external library , ...GMPInteger_cpp.pm is as close to an example as you will find

    ...GMPInteger_cpp.pm is RPerl specific way of using Inline::CPP to call cpp functions from external cpp libraries ...

    Will_the_Chill has been here in a while

    Open an issue at https://github.com/wbraswell/rperl/issues and maybe negotiate :)

      If rperl is just a layer on top of Inline::CPP, then what is the advantage over patching B::Deparse to convert Perl Snippets to CPP?

      For instance code like the following

      sub func :cpp int { my int ($a,$b) = @_; return $a+$b }

      is (after predefining :cpp and int) legal perl5 syntax and B::Deparse gets all necessary details.

      sub func { (my int ($a, $b)) = @_; return $a + $b; } use attributes ('main', sub { (my int ($a, $b)) = @_; return $a + $b; } , 'cpp', 'int');

      So whats the extra value of rperl?

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

        If rperl is just a layer on top of Inline::CPP, then what is the advantage over patching B::Deparse to convert Perl Snippets to CPP? ...So whats the extra value of rperl?

        You tell me?

        Is it not clear? I mean you must have at this point read everything there is to read about RPerl, the faq , docs , benchmarks / examples , jokes / original discussions about creating rperl...

        Old clues https://metacpan.org/source/RURBAN/B-C-1.57/ramblings/rperl.md

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11104449]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2022-01-27 05:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (70 votes). Check out past polls.

    Notices?