petdance/scratch — Issue #644: postgres libraries don't work from foreign HLLs
Author: petdance
Created: 2011-11-01 05:35:32+00:00
State: open
Labels: bug, library, Pri-normal, Sev-medium

This works without error:

{{{
.sub main :main
load_bytecode 'Pg.pir'
$P0 = new 'Pg'
$P1 = $P0.'connectdb'('')
.end
}}}

But this dies:
{{{
.HLL 'foo'
.sub main :main
load_bytecode 'Pg.pir'
$P0 = new 'Pg'
$P1 = $P0.'connectdb'('')
.end
}}}

Error:

{{{
Null PMC access in invoke()
current instr.: 'foo;Pg;Conn;status' pc 137 (/home/moritz/rakudo/parrot_install/lib/2.5.0-devel/library/Pg.pir:150)
called from Sub 'foo;Pg;connectdb' pc 55 (/home/moritz/rakudo/parrot_install/lib/2.5.0-devel/library/Pg.pir:86)
called from Sub 'main' pc 12 (foo.pir:5)
}}}

Either Pg should be in the 'parrot' HLL, and needs explicit calling, or it should work anywhere it is included.
Trac ID #1692