diff options
| author | Felix Perktold <Felix.Perktold@student.uibk.ac.at> | 2026-01-18 15:47:48 +0100 |
|---|---|---|
| committer | Felix Perktold <Felix.Perktold@student.uibk.ac.at> | 2026-01-18 15:47:48 +0100 |
| commit | db3fdda53f16644181a6c68b3e9152af9b300066 (patch) | |
| tree | f9d3c5c9d9f9752582d162d08c9b0d025a6c6ceb /modules/test_module.c | |
| parent | b86d3361836935297c6aedb0318ed8a34e4c52f0 (diff) | |
add module system to load .so with load_module builtin
Diffstat (limited to 'modules/test_module.c')
| -rw-r--r-- | modules/test_module.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/test_module.c b/modules/test_module.c new file mode 100644 index 0000000..ead7b91 --- /dev/null +++ b/modules/test_module.c @@ -0,0 +1,19 @@ +#include <stdio.h> +#include "../lisp_api.h" + +value *hello_fun(env *e, value *args) { + printf("Hello from dynamically loaded module!\n"); + return make_nil(); +} + +module_export *module_init() { + static module_export exports[2]; + + exports[0].name = "hello"; + exports[0].v = make_builtin(&hello_fun); + + exports[1].name = NULL; + exports[1].v = NULL; + + return exports; +} |
