Find the correct library file from the chainloader

Instead of using this hardcdoed path.
This commit is contained in:
Robbert van der Helm
2022-04-16 19:26:27 +02:00
parent 85989f4c1d
commit d73a0041eb
8 changed files with 151 additions and 22 deletions
+11 -8
View File
@@ -20,8 +20,12 @@
#include <dlfcn.h>
// Generated inside of the build directory
#include <config.h>
#include "../common/linking.h"
#include "../common/utils.h"
#include "utils.h"
// These chainloader libraries are tiny, mostly dependencyless libraries that
// `dlopen()` the actual `libyabridge-{vst2,vst3}.so` files and forward the
@@ -35,8 +39,6 @@
// distro packaging, because updates to Boost might require the package to be
// rebuilt, which in turn would also require a resync.
// TODO: Order to check in: See Discord
namespace fs = ghc::filesystem;
using Vst3PluginBridge = void;
@@ -83,11 +85,10 @@ bool initialize_library() {
return true;
}
// FIXME: Hardcoded path
library_handle = dlopen(
"/home/robbert/Documenten/projecten/yabridge/build/libyabridge-vst3.so",
RTLD_LAZY | RTLD_LOCAL);
assert(library_handle);
library_handle = find_plugin_library(yabridge_vst3_plugin_name);
if (!library_handle) {
return false;
}
#define LOAD_FUNCTION(name) \
do { \
@@ -109,7 +110,9 @@ extern "C" YABRIDGE_EXPORT bool ModuleEntry(void*) {
// This function can be called multiple times, so we should make sure to
// only initialize the bridge on the first call
if (active_instances.fetch_add(1, std::memory_order_seq_cst) == 0) {
assert(initialize_library());
if (!initialize_library()) {
return false;
}
// You can't change the deleter function with `.reset()` so we'll need
// this abomination instead