tokuhirom
9/17/2009 - 9:30 AM

Makefile

ELFt�4�4 (���������������������<title>hok</title>
.symtab.strtab.shstrtab.text.datat�t"!����'��	T.t�����	��t�����"����)����message_exit_start__bss_start_edata_end
.section .data
  message:
    .ascii "<title>hok</title>\n"

.section .text
  .global _start
  _start:
    movl  $4,%eax
    movl  $1,%ebx
    movl  $message,%ecx   
    movl  $19,%edx
    int   $0x80

  _exit:
    movl  $1,%eax
    movl  $0,%ebx
    int   $0x80   
mattn: pipe() は Perl の場合、win32 でもうごきますか?

動きます。

-----------------------------------------
#!/usr/bin/perl -w

use IO::Handle;

pipe(PARENTREAD, PARENTWRITE);
pipe(CHILDREAD, CHILDWRITE);

PARENTWRITE->autoflush(1);
CHILDWRITE->autoflush(1);

if ($child = fork) {
   close CHILDREAD;
   close PARENTWRITE;
   print CHILDWRITE "34+56;\n";
   chomp($result = <PARENTREAD>);
   print "白ヤギさんから答えが来た: $result\n";
   close PARENTREAD;
   close CHILDWRITE;
   waitpid($child,0);
} else {
   close PARENTREAD;
   close CHILDWRITE;
   chomp($calculation = <CHILDREAD>);
   print "黒ヤギさんから計算式来た: $calculation\n";
   $result = eval "$calculation";
   print PARENTWRITE "$result\n";
   close CHILDREAD;
   close PARENTWRITE;
   exit;
}

おお。すばらしい。ありがとうございます! -- tokuhirom
hello.txt: hello.as
	as -o hello.o hello.as
	ld -o hello.txt hello.o