Add External Libraries

2026-01-15 17:18:01 +11:00
parent ee33a98bee
commit 088c7f7c53

17
External-Libraries.md Normal file

@@ -0,0 +1,17 @@
CGround supports creating your own ground functions written in C. While theoretically any language that can compile to a shared object file can be used, C is the language most supported.
# Creating an External Library (in C)
For this example, we will make a function that returns "Hello, {arg1}!"
Our ground syntax will be `call !Example_GreetUser $username &greet`
## C code
First, import `groundext.h`. Then, start a new function. For our example, we will call it `greetUser`.
```c
#include <groundext.h>
GroundValue greetUser(GroundScope* scope, List args) {
}
```
To create our function, we need to access our arguments. Use `args.value`