summaryrefslogtreecommitdiff
path: root/modules/test_module.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/test_module.c')
-rw-r--r--modules/test_module.c19
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;
+}