Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Properly initialize callbacks when used from Inline::Perl6
  • Loading branch information
niner committed Feb 7, 2015
1 parent 1a9085c commit 5902244
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/Inline/Perl5.pm6
Expand Up @@ -59,6 +59,9 @@ class ObjectKeeper {
sub p5_init_perl()
returns Perl5Interpreter { ... }
native(&p5_init_perl);
sub p5_inline_perl6_xs_init(Perl5Interpreter)
{ ... }
native(&p5_inline_perl6_xs_init);
sub p5_SvIOK(Perl5Interpreter, OpaquePointer)
returns int32 { ... } # should be uint32 once that's supported
native(&p5_SvIOK);
Expand Down Expand Up @@ -504,6 +507,10 @@ method init_callbacks {
]);

self.call('v6::init', Perl6PackageCreator.new);

if $!external_p5 {
p5_inline_perl6_xs_init($!p5);
}
}

method sv_refcnt_dec($obj) {
Expand Down
6 changes: 6 additions & 0 deletions p5helper.c
Expand Up @@ -17,6 +17,12 @@ EXTERN_C void xs_init(pTHX) {
newXS("Perl6::Callable::call", p5_call_p6_callable, file);
}

void p5_inline_perl6_xs_init(PerlInterpreter *my_perl) {
char *file = __FILE__;
newXS("Perl6::Object::call_method", p5_call_p6_method, file);
newXS("Perl6::Callable::call", p5_call_p6_callable, file);
}

static int inited = 0;

PerlInterpreter *p5_init_perl() {
Expand Down

0 comments on commit 5902244

Please sign in to comment.