Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^3: About using rperl

by Laurent_R (Canon)
on Aug 13, 2019 at 10:26 UTC ( #11104376=note: print w/replies, xml ) Need Help??

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

It would be great to see an example of how to call a sub in the shared library
I haven't seen such example of code, but I attended a talk by Will Braswell a few months ago, and asked whether it is feasible, and Will answered that it is possible. So you could have your CPU intensive nested loops or other computations in a RPerl module, and the rest in a regular Perl program. This looks very interesting to me, because it seems easier to write a RPerl module than an XS module.

Replies are listed 'Best First'.
Re^4: About using rperl
by LanX (Sage) on Aug 13, 2019 at 14:42 UTC
    Please excuse my ignorance, but wouldn't this imply having two runtime environments for Perl communicating via sub calls?

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

      I'm not sure how this would work exactly, but my understanding (I could be wrong) was that RPerl components are compiled to binaries (after a translation phase to C++) and probably don't need a specific runtime environment. So you would only need to include the proper modules in your Perlrapper.
Re^4: About using rperl
by Anonymous Monk on Aug 14, 2019 at 02:28 UTC
      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.. :)


        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 , is as close to an example as you will find 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 and maybe negotiate :)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2023-04-01 16:50 GMT
Find Nodes?
    Voting Booth?

    No recent polls found