Skip to content

How to load a compiled RPerl module from a regular perl script? #105

Open
@hakonhagland

Description

@hakonhagland

Hello everyone! I am interested in mixing compiled RPerl code with regular perl scripts (as a replacement for writing an XS module). I have this simple test RPerl module:

# [[[ HEADER ]]]
use RPerl;
package MyModule;
use strict;
use warnings;
our $VERSION = 0.001_000;

# [[[ CRITICS ]]]
## no critic qw(ProhibitUselessNoCritic ProhibitMagicNumbers RequireCheckedSyscalls)  # USER DEFAULT 1: allow numeric values & print operator

# [[[ SUBROUTINES ]]]

sub foo {
    { my void $RETURN_TYPE };
    print "MyModule: foo()\n";
    return;
}

I can compile this into c++ (MyModule.cpp) using rperl MyModule.pm.

Then, I have a regular Perl script p.pl (not RPerl) where I would like to use the compiled RPerl module:

#! /usr/bin/env perl
use strict;
use warnings;

use lib '.';
# use MyModule;  # <-- How to include the compiled RPerl module??

print "main: starting..\n";
MyModule::foo();
print "main: finished..\n";

How can I include the compiled RPerl module here?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions