summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
author0scar <qgt268@alumni.ku.dk>2023-07-28 14:32:58 +0000
committer0scar <qgt268@alumni.ku.dk>2023-07-28 18:26:17 +0000
commit4cb29fbc2d20f20e9d605796b137b4b70363113a (patch)
tree9b5929ff4d16a7a2472bafac48196e5ddfabc7dd /include
parent5ee7f4b4b033de403f1861eedc942c7a5a0f31b6 (diff)
Implement hotloading
* This commit implements dltools.{c,h}: _A simple wrapper around libdl / dlfcn.h_ * Reload states when done initializing engine, if hotloading is enabled. * Adds general function types for state functions.
Diffstat (limited to 'include')
-rw-r--r--include/engine/dltools.h14
-rw-r--r--include/engine/state.h3
2 files changed, 17 insertions, 0 deletions
diff --git a/include/engine/dltools.h b/include/engine/dltools.h
new file mode 100644
index 0000000..9306ae7
--- /dev/null
+++ b/include/engine/dltools.h
@@ -0,0 +1,14 @@
+#ifndef DLTOOLS_H
+#define DLTOOLS_H
+
+/* Utility functions for handling runtime linked shared libraries */
+bool dynamic_library_close(void* shared_library);
+void* dynamic_library_open(const char *library_path);
+void* dynamic_library_reload(void* shared_library, const char *library_path);
+
+/* Returns the address of symbol in the provided shared_library handle.
+ * NULL on error*/
+void* dynamic_library_get_symbol(void* shared_library, const char *symbol);
+char* dynamic_library_get_error(void);
+
+#endif
diff --git a/include/engine/state.h b/include/engine/state.h
index 402c701..cf486cc 100644
--- a/include/engine/state.h
+++ b/include/engine/state.h
@@ -20,4 +20,7 @@ void State_init(StateType type, memory *mem);
void State_free(StateType type, memory *mem);
StateType State_update(StateType type, memory *mem);
+/* Reloads shared object file associated with state */
+bool State_reload(StateType type);
+
#endif