Running K/ngnk: Difference between revisions

Content added Content deleted
No edit summary
No edit summary
 
Line 23: Line 23:
Roughly, including external libraries into ngn/k programs consists of three steps:
Roughly, including external libraries into ngn/k programs consists of three steps:


1. Write a K-compatible C program by including the <code>k.h</code> header
# Write a K-compatible C program by including the <code>k.h</code> header
2. Compile the C program into a shared object file
# Compile the C program into a shared object file
3. Inside of a K program, load the shared object file and assign it to a verb.
# Inside of a K program, load the shared object file and assign it to a verb.


Note that <code>k.h</code> and <code>libk.so</code> must be available to your compiler and linker, respectively:
Note that <code>k.h</code> and <code>libk.so</code> must be available to your compiler and linker, respectively:


1. <code>k.h</code> is available in the ngn/k source code;
# <code>k.h</code> is available in the ngn/k source code;
2. The ngn/k makefile includes a target to build <code>libk.so</code>.
# The ngn/k makefile includes a target to build <code>libk.so</code>.


(The AUR package above installs both of the required files into the standard system directories)
(The AUR package above installs both of the required files into the standard system directories)