summaryrefslogtreecommitdiffhomepage
path: root/src/sst.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sst.c')
-rw-r--r--src/sst.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/sst.c b/src/sst.c
index 3618210..6b03acf 100644
--- a/src/sst.c
+++ b/src/sst.c
@@ -250,6 +250,7 @@ static const char *updatenotes = "\
#include <featureinit.gen.h> // generated by build/codegen.c
static void do_featureinit(void) {
+ engineapi_lateinit();
// load libs that might not be there early (...at least on Linux???)
clientlib = os_dlhandle(OS_LIT("client") OS_LIT(OS_DLSUFFIX));
if (!clientlib) {
@@ -410,22 +411,19 @@ static bool do_load(ifacefactory enginef, ifacefactory serverf) {
}
static void do_unload(void) {
-#ifdef _WIN32 // this is only relevant in builds that predate linux support
- if (pluginhandler) { // if not, oh well too bad :^)
+ if (sst_userunloaded) { // note: pluginhandler must also be set here
cmd_plugin_load->cb = orig_plugin_load_cb;
cmd_plugin_unload->cb = orig_plugin_unload_cb;
- if (sst_userunloaded) {
- struct CPlugin **plugins = pluginhandler->plugins.m.mem;
- // see comment in CPlugin above. setting this to the real handle
- // right before the engine tries to unload us allows it to actually
- // do so. in newer branches this is redundant but doesn't do any
- // harm so it's just unconditional. NOTE: old engines ALSO just leak
- // the handle and never call Unload() if Load() fails; can't really
- // do anything about that.
- plugins[ownidx]->module = ownhandle();
- }
- }
+#ifdef _WIN32 // this bit is only relevant in builds that predate linux support
+ struct CPlugin **plugins = pluginhandler->plugins.m.mem;
+ // see comment in CPlugin above. setting this to the real handle right
+ // before the engine tries to unload us allows it to actually do so. in
+ // newer branches this is redundant but doesn't do any harm so it's just
+ // unconditional. NOTE: old engines ALSO just leak the handle and never
+ // call Unload() if Load() fails; can't really do anything about that.
+ plugins[ownidx]->module = ownhandle();
#endif
+ }
endfeatures();
con_disconnect();
}