Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hakonhagland opened this issue Aug 15, 2019 · 0 comments
Open

Comments

@hakonhagland
Copy link

hakonhagland commented Aug 15, 2019

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant