diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2024-02-11 22:55:00 -0700 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2024-02-11 22:55:00 -0700 |
| commit | e008ac8d837ad11557c7625f3c311f230986d7f5 (patch) | |
| tree | eb199548bd6fa8cad186a301194e930cc8636bc5 /harness/src/plugin.c | |
| parent | 2d530e35ee67126c83afb89ed7a3066b65782f57 (diff) | |
| download | montis-e008ac8d837ad11557c7625f3c311f230986d7f5.tar.gz montis-e008ac8d837ad11557c7625f3c311f230986d7f5.tar.bz2 montis-e008ac8d837ad11557c7625f3c311f230986d7f5.zip | |
Added event handlers for map/unmap/destroy surfaces, added Alt+F5 for hot reload.
It turns out I could actually remove the metaload handler from the
plugin interface. As things turn out, when fully unloading the shared
object and reloading it, the Haskell runtime no longer complained. This
makes things much simpler, which is great.
I do wonder if I'm going to run into issues because of this, but I'll
cross that bridge when it's burning.
Diffstat (limited to 'harness/src/plugin.c')
| -rw-r--r-- | harness/src/plugin.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/harness/src/plugin.c b/harness/src/plugin.c index d71608a..6344f4a 100644 --- a/harness/src/plugin.c +++ b/harness/src/plugin.c @@ -37,7 +37,7 @@ static void shx(uint8_t *state, uint32_t sz) { } } -int read_plugin_from_file(const char *filename, plugin_t *plugin) { +int load_plugin_from_file(const char *filename, plugin_t *plugin) { dlhandle_t lib = dlopen(filename, RTLD_LAZY); if (!lib) { @@ -49,7 +49,7 @@ int read_plugin_from_file(const char *filename, plugin_t *plugin) { return load_plugin_from_dl(lib, plugin); } -int plugin_hot_reload(int argc, char **argv, dlhandle_t library, +int plugin_hot_reload(int argc, char **argv, const char* filepath, plugin_t *plugin) { int ec = 0; uint32_t sz = 0; @@ -67,12 +67,10 @@ int plugin_hot_reload(int argc, char **argv, dlhandle_t library, printf("State Marshalled:\n"); shx(marshalled_state, sz); - if (library != plugin->library_handle) { - printf("Unloading old library handle.\n"); - dlclose(plugin->library_handle); - } + printf("Unloading old library handle.\n"); + dlclose(plugin->library_handle); - if ((ec = load_plugin_from_dl(library, plugin))) { + if ((ec = load_plugin_from_file(filepath, plugin))) { goto fail; } |