summaryrefslogtreecommitdiffhomepage
path: root/examples/native-function.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2022-08-24 16:35:51 +0200
committerJo-Philipp Wich <jo@mein.io>2022-08-24 16:37:11 +0200
commitbcdd2cb33797412cce1f1014d265a71461676cff (patch)
tree24f66afaedf7e9aa9c59c19640635fca5ffe0c1b /examples/native-function.c
parentee1946fad8a81b1917052292accafe91b7a1bb89 (diff)
examples: add module search path initialization and freeing
Since commit 3c168b5 ("vm, cli: move search path into global config...") it is required to explicitly initialize the module search path in the configuration structure for compile time module imports and run time require operations to work. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'examples/native-function.c')
-rw-r--r--examples/native-function.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/native-function.c b/examples/native-function.c
index 5c2f6da..190c95c 100644
--- a/examples/native-function.c
+++ b/examples/native-function.c
@@ -77,6 +77,9 @@ int main(int argc, char **argv)
return 1;
}
+ /* initialize default module search path */
+ uc_search_path_init(&config.module_search_path);
+
/* initialize VM context */
uc_vm_t vm = { 0 };
uc_vm_init(&vm, &config);
@@ -103,5 +106,8 @@ int main(int argc, char **argv)
/* free VM context */
uc_vm_free(&vm);
+ /* free search module path vector */
+ uc_search_path_free(&config.module_search_path);
+
return exit_code;
}