Plan9でHello, world!
まずは,実物を見てもらった方が早いだろう.お約束ということで,まずは"Hello, world!"から.u.hはアーキテクチャ依存,libc.hはアーキテクチャ非依存のヘッダファイルで,この二つは最低限includeする必要がある.
#include <u.h> #include <libc.h> void main(int argc, char **argv) { print("Hello, world!\n"); }
では,コンパイル&実行してみよう.コンパイラ,ローダ,アセンブラの頭字はアーキテクチャを指している.8がi386である.デフォルトの実行バイナリもa.outではなく,8.outのようにアーキテクチャごとに違う.
% 8c hello.c % 8l hello.8 % 8.out Hello, world!
- Plan 9 C Compilers (Ken Thompson)
- How to Use the Plan 9 C Compiler (Rob Pike)