Update [WIP] External Libraries
@@ -63,7 +63,7 @@ GroundValue greetUser(GroundScope* scope, List args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ground_init(GroundScope* scope) {
|
void ground_init(GroundScope* scope) {
|
||||||
groundAddNativeFunction(scope, "Example.GreetUser", greetUser, STRING, 1, STRING, "username");
|
groundAddNativeFunction(scope, "Example_GreetUser", greetUser, STRING, 1, STRING, "username");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
Now all we need to do is compile with `gcc file.c -shared -o file.so -fPIC`.
|
Now all we need to do is compile with `gcc file.c -shared -o file.so -fPIC`.
|
||||||
@@ -74,13 +74,13 @@ Once we have created the shared object file, we can import it as follows
|
|||||||
```grnd
|
```grnd
|
||||||
extern "file"
|
extern "file"
|
||||||
```
|
```
|
||||||
We can call our function with `call !Example.GreetUser $string &out`
|
We can call our function with `call !Example_GreetUser $string &out`
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```py
|
```py
|
||||||
extern "file"
|
extern "file"
|
||||||
|
|
||||||
call !Example.GreetUser "DiamondNether90" &out
|
call !Example_GreetUser "DiamondNether90" &out
|
||||||
println $out # Prints "Hello, DiamondNether90!"
|
println $out # Prints "Hello, DiamondNether90!"
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user