From bc4b83f4436c39d39d61a9f97d226204dc0a02d1 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 27 Jan 2014 00:29:16 +0100 Subject: [PATCH] LADSPA/CMT: fixed global initialization on Win32 Global initialization happens via a global startup/shutdown handler instance. For some reason this does not work properly when building a DLL file, therefore create this startup/shutdown handler instance as a static variable in ladspa_descriptor(). Furthermore marked ladspa_descriptor as extern-C. --- plugins/ladspa_effect/cmt/src/init.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/ladspa_effect/cmt/src/init.cpp b/plugins/ladspa_effect/cmt/src/init.cpp index 76a7b2634..f232840fa 100644 --- a/plugins/ladspa_effect/cmt/src/init.cpp +++ b/plugins/ladspa_effect/cmt/src/init.cpp @@ -108,18 +108,26 @@ public: finalise_modules(); } -} g_oStartupShutdownHandler; +} ; /*****************************************************************************/ +extern "C" +{ + const LADSPA_Descriptor * ladspa_descriptor(unsigned long Index) { + + static StartupShutdownHandler handler; + if (Index < g_lPluginCount) return g_ppsRegisteredDescriptors[Index]; else return NULL; } +}; + /*****************************************************************************/ /* EOF */