Differences From
Artifact [28c0315020]:
1 1 # kcore
2 2 **kcore** is the foundation for the rest of libk. it defines types and structs that are needed by every program, and provides the stub that launches a program's "entry" function.
3 3
4 4 ## entry
5 5 when using libk, your program's entry point will not be the `int main(int,char**)` function that libc opens into. libk will call the function `stat entry(kenv)` instead. like libc, the value returned by `entry` will be returned to the host platform.
6 6
7 7 ## types
8 -kcore contains fixed-width integer types. note that the available of each depends on your platform; compilation will fail if e.g. you try to use a u64 or a u128 on a 32-bit platform, so where exact lengths are not required, you may wish to use the built-in C types instead.
8 +kcore contains fixed-width integer types (in <k/type.h>). note that the availability of each depends on your platform; compilation will fail if e.g. you try to use a u64 or a u128 on a 32-bit platform, so where exact lengths are not required, you may wish to use the built-in C types instead.
9 9
10 10 * `u8` - an unsigned 8-bit integer
11 11 * `s8` - a signed 8-bit integer
12 12 * `u16` - an unsigned 16-bit integer
13 13 * `s16` - a signed 16-bit integer
14 14 * `u32` - an unsigned 32-bit integer
15 15 * `s32` - a signed 32-bit integer
................................................................................
21 21 * `sword` - a signed integer of platform word-length (e.g. 32 bits on x86.32; 64 on x86.64)
22 22 * `stat` - the type of process return values expected by the platform (usually u8 on linux)
23 23
24 24 ### struct kenv
25 25 `kenv` is a struct that encompasses the environment the program was launched in.
26 26 * `kiochan std` - a stereo IO channel for reading and writing to and from stdout.
27 27 * `kiochan err` - a mono IO channel for writing to stderr.
28 - * `kvar* env` - a pointer into the program's environment
28 + * `kvar* vars` - a pointer into the program's environment
29 29
30 30 ### struct kvar
31 31 `kvar` is a struct that abstracts over platform environment variables.
32 32 * `kstr name` - the name of an environment variable
33 33 * `kstr val` - the value of an environment variable
34 34 * `char* platform` - a pointer into the platform's underlying representation