A simple C program on the 9p system that outputs a message to the
console is shown below. To build and link the source code is shown
below the code.
Start File "hello.c"
#include <u.h>
#include <libc.h>
void main(void)
{
print("Hello, 9p!\n");
exits(0);
}
End File "hello.c"
The file is compiled for the AMD 64 processor using the command:
6c hello.c
This produces an object file named hello.6. This object file is
then linked using the command:
6l hello.6
This produces an executable named 6.out, which can be run:
./6.out
This produces the expected "Hello, 9p!" in the console.