Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
replace open() by nqp:: ops
This is needed because open() thinks the CC we invoke sits in our CWD.
Since this is not the case and it is hard to figure out where a binary
is (especially on windows), we need re-implement 95% of open's magic.
  • Loading branch information
FROGGS committed Nov 20, 2013
1 parent a88fed5 commit 9113eb2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/Inline/C.pm
Expand Up @@ -20,9 +20,11 @@ method postcircumfix:<( )>(Mu \args) {
$!libname = $basename ~ 1000.rand while $!libname.IO.e;
my $o = $*VM<config><o>;
my $so = $*VM<config><load_ext>;
if my $CC = open( "$*VM<config><cc> -c $*VM<config><cc_shared> $*VM<config><cc_o_out>$!libname$o $*VM<config><ccflags> -xc -", :w, :p ) or warn $! {
$CC.print( $!code );
$CC.close;

my $cmd = "$*VM<config><cc> -c $*VM<config><cc_shared> $*VM<config><cc_o_out>$!libname$o $*VM<config><ccflags> -xc -";
if my Mu $CC := nqp::open(nqp::unbox_s($cmd), nqp::unbox_s("wp")) or die $! {
nqp::printfh($CC, nqp::unbox_s($!code));
nqp::closefh($CC);
my $l_line = "$*VM<config><ld> $*VM<config><ld_load_flags> $*VM<config><ldflags> " ~
"$*VM<config><libs> $*VM<config><ld_out>$!libname$so $!libname$o";
shell($l_line);
Expand Down

0 comments on commit 9113eb2

Please sign in to comment.