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 audioMasterCallback = void*;
@@ -65,11 +67,10 @@ bool initialize_library() {
return true;
}
// FIXME: Hardcoded path
library_handle = dlopen(
"/home/robbert/Documenten/projecten/yabridge/build/libyabridge-vst2.so",
RTLD_LAZY | RTLD_LOCAL);
assert(library_handle);
library_handle = find_plugin_library(yabridge_vst2_plugin_name);
if (!library_handle) {
return false;
}
#define LOAD_FUNCTION(name) \
do { \
@@ -89,7 +90,9 @@ extern "C" YABRIDGE_EXPORT AEffect* VSTPluginMain(
audioMasterCallback host_callback) {
assert(host_callback);
initialize_library();
if (!initialize_library()) {
return nullptr;
}
const fs::path this_plugin_path = get_this_file_location();
return yabridge_plugin_init(host_callback, this_plugin_path.c_str());