From 0421f5dec91fdb939db863c644b5ffdb24abda26 Mon Sep 17 00:00:00 2001 From: Paolo Date: Thu, 20 Jun 2024 17:47:16 +0200 Subject: [PATCH] vst3 bug fix in dllmain --- templates/vst3/src/vst3.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/vst3/src/vst3.c b/templates/vst3/src/vst3.c index 98dfb33..6a63b6a 100644 --- a/templates/vst3/src/vst3.c +++ b/templates/vst3/src/vst3.c @@ -66,6 +66,7 @@ typedef struct { // https://github.com/rubberduck-vba/Rubberduck/wiki/COM-in-plain-C // https://devblogs.microsoft.com/oldnewthing/20040205-00/?p=40733 +//#define TIBIA_TRACE #ifdef TIBIA_TRACE # define TRACE(...) printf(__VA_ARGS__); fflush(stdout); #else @@ -2167,14 +2168,17 @@ DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { EXPORT # if defined(__APPLE__) char bundleEntry(CFBundleRef ref) { + (void)ref; # else char ModuleEntry(void *handle) { + (void)handle; # endif - (void)ref; char *file; if (refs == 0) { Dl_info info; - if (dladdr((void*) bindir, &info) == 0) + union { void* d; char (*f)(); } v; + v.f = vstExit; + if (dladdr((void*) v.d, &info) == 0) return 0; file = realpath(info.dli_fname, NULL); if (file == NULL)