Browse Source

Use plugin-CPU.EXT filename for plugin binary on non-x64 CPUs, so multiple binaries can coexist.

tags/v2.2.2
Andrew Belt 1 year ago
parent
commit
f7c8e097e2
2 changed files with 19 additions and 4 deletions
  1. +9
    -3
      plugin.mk
  2. +10
    -1
      src/plugin.cpp

+ 9
- 3
plugin.mk View File

@@ -23,8 +23,14 @@ LDFLAGS += -L$(RACK_DIR) -lRack

include $(RACK_DIR)/arch.mk

TARGET := plugin
ifndef ARCH_X64
# On non-x64, append CPU name to plugin binary
TARGET := $(TARGET)-$(ARCH_CPU)
endif

ifdef ARCH_LIN
TARGET := plugin.so
TARGET := $(TARGET).so
# This prevents static variables in the DSO (dynamic shared object) from being preserved after dlclose().
FLAGS += -fno-gnu-unique
# When Rack loads a plugin, it symlinks /tmp/Rack2 to its system dir, so the plugin can link to libRack.
@@ -35,13 +41,13 @@ ifdef ARCH_LIN
endif

ifdef ARCH_MAC
TARGET := plugin.dylib
TARGET := $(TARGET).dylib
LDFLAGS += -undefined dynamic_lookup
RACK_USER_DIR ?= $(HOME)/Documents/Rack2
endif

ifdef ARCH_WIN
TARGET := plugin.dll
TARGET := $(TARGET).dll
LDFLAGS += -static-libstdc++
RACK_USER_DIR ?= $(USERPROFILE)/Documents/Rack2
endif


+ 10
- 1
src/plugin.cpp View File

@@ -102,7 +102,16 @@ static InitCallback loadPluginCallback(Plugin* plugin) {
#elif ARCH_MAC
libraryExt = "dylib";
#endif
std::string libraryPath = system::join(plugin->path, "plugin." + libraryExt);

#if defined ARCH_X64
// Use `plugin.EXT` on x64 for backward compatibility.
// Change to `plugin-OS-CPU.EXT` in Rack 3.
std::string libraryFilename = "plugin." + libraryExt;
#else
// Use `plugin-CPU.EXT` on other CPUs like ARM64
std::string libraryFilename = "plugin-" + APP_CPU + "." + libraryExt;
#endif
std::string libraryPath = system::join(plugin->path, libraryFilename);

// Check file existence
if (!system::isFile(libraryPath))


Loading…
Cancel
Save