From 703438d8e55dbfd1c2021d0bc12e36edd1e227e2 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Fri, 27 Sep 2024 17:47:32 +0100 Subject: [PATCH] Permit a special case in which libraries are not unloaded --- src/vamp-hostsdk/Files.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/vamp-hostsdk/Files.cpp b/src/vamp-hostsdk/Files.cpp index 8dda7ff..171f4a3 100644 --- a/src/vamp-hostsdk/Files.cpp +++ b/src/vamp-hostsdk/Files.cpp @@ -188,11 +188,18 @@ Files::loadLibrary(string path) void Files::unloadLibrary(void *handle) { + // For special purposes allow the build to specify that libraries + // should not be unloaded. This turns out to be useful with some + // older plugins we have tried on 32-bit Windows which crash if + // unloaded and reloaded again in the same process. +#ifndef DO_NOT_FREE_LIBRARIES + #ifdef _WIN32 FreeLibrary((HINSTANCE)handle); #else dlclose(handle); #endif +#endif } void *