Permalink
Browse files

use a pipe directly to pass the C code to compiler

  • Loading branch information...
1 parent f7b6851 commit e061cfc344f7d45ccbe08497d66e431f502f1eb5 @FROGGS committed Sep 17, 2012
Showing with 7 additions and 6 deletions.
  1. +7 −6 lib/Inline/C.pm
View
@@ -119,12 +119,13 @@ $code";
$!libname = $basename ~ 1000.rand while $!libname.IO.e;
my $o = $*VM<config><o>;
my $so = $*VM<config><load_ext>;
- my $c_line = "echo '$!code' | $*VM<config><cc> -c $*VM<config><cc_shared> $*VM<config><cc_o_out>$!libname$o $*VM<config><ccflags> -xc -";
- 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($c_line);
- shell($l_line);
-
+ 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 $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);
+ }
}
my Mu $arg_info := param_list_for($r.signature);
my str $conv = self.?native_call_convention || '';

0 comments on commit e061cfc

Please sign in to comment.