mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Fix yabridge_version() in chainloaders
The function doesn't (and cannot) have the same name as the function pointer, so `MAYBE_LOAD_FUNCTION()` does the wrong thing here. May as well just do it manually.
This commit is contained in:
@@ -94,27 +94,27 @@ bool initialize_library() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAYBE_LOAD_FUNCTION(name) \
|
#define LOAD_FUNCTION(name) \
|
||||||
do { \
|
do { \
|
||||||
(name) = \
|
(name) = \
|
||||||
reinterpret_cast<decltype(name)>(dlsym(library_handle, #name)); \
|
reinterpret_cast<decltype(name)>(dlsym(library_handle, #name)); \
|
||||||
} while (false)
|
if (!(name)) { \
|
||||||
#define LOAD_FUNCTION(name) \
|
log_failing_dlsym(yabridge_clap_plugin_name, #name); \
|
||||||
do { \
|
return false; \
|
||||||
MAYBE_LOAD_FUNCTION(name); \
|
} \
|
||||||
if (!(name)) { \
|
|
||||||
log_failing_dlsym(yabridge_clap_plugin_name, #name); \
|
|
||||||
return false; \
|
|
||||||
} \
|
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
LOAD_FUNCTION(yabridge_module_init);
|
LOAD_FUNCTION(yabridge_module_init);
|
||||||
LOAD_FUNCTION(yabridge_module_free);
|
LOAD_FUNCTION(yabridge_module_free);
|
||||||
LOAD_FUNCTION(yabridge_module_get_factory);
|
LOAD_FUNCTION(yabridge_module_get_factory);
|
||||||
MAYBE_LOAD_FUNCTION(remote_yabridge_version);
|
|
||||||
|
// This one can be a null pointer if the function does not yet exist in this
|
||||||
|
// yabridge version
|
||||||
|
remote_yabridge_version =
|
||||||
|
reinterpret_cast<decltype(remote_yabridge_version)>(
|
||||||
|
dlsym(library_handle, "yabridge_version"));
|
||||||
|
|
||||||
#undef LOAD_FUNCTION
|
#undef LOAD_FUNCTION
|
||||||
#undef MAYBE_LOAD_FUNCTION
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,25 +77,25 @@ bool initialize_library() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAYBE_LOAD_FUNCTION(name) \
|
#define LOAD_FUNCTION(name) \
|
||||||
do { \
|
do { \
|
||||||
(name) = \
|
(name) = \
|
||||||
reinterpret_cast<decltype(name)>(dlsym(library_handle, #name)); \
|
reinterpret_cast<decltype(name)>(dlsym(library_handle, #name)); \
|
||||||
} while (false)
|
if (!(name)) { \
|
||||||
#define LOAD_FUNCTION(name) \
|
log_failing_dlsym(yabridge_vst2_plugin_name, #name); \
|
||||||
do { \
|
return false; \
|
||||||
MAYBE_LOAD_FUNCTION(name); \
|
} \
|
||||||
if (!(name)) { \
|
|
||||||
log_failing_dlsym(yabridge_vst2_plugin_name, #name); \
|
|
||||||
return false; \
|
|
||||||
} \
|
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
LOAD_FUNCTION(yabridge_plugin_init);
|
LOAD_FUNCTION(yabridge_plugin_init);
|
||||||
MAYBE_LOAD_FUNCTION(remote_yabridge_version);
|
|
||||||
|
// This one can be a null pointer if the function does not yet exist in this
|
||||||
|
// yabridge version
|
||||||
|
remote_yabridge_version =
|
||||||
|
reinterpret_cast<decltype(remote_yabridge_version)>(
|
||||||
|
dlsym(library_handle, "yabridge_version"));
|
||||||
|
|
||||||
#undef LOAD_FUNCTION
|
#undef LOAD_FUNCTION
|
||||||
#undef MAYBE_LOAD_FUNCTION
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,27 +94,27 @@ bool initialize_library() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAYBE_LOAD_FUNCTION(name) \
|
#define LOAD_FUNCTION(name) \
|
||||||
do { \
|
do { \
|
||||||
(name) = \
|
(name) = \
|
||||||
reinterpret_cast<decltype(name)>(dlsym(library_handle, #name)); \
|
reinterpret_cast<decltype(name)>(dlsym(library_handle, #name)); \
|
||||||
} while (false)
|
if (!(name)) { \
|
||||||
#define LOAD_FUNCTION(name) \
|
log_failing_dlsym(yabridge_vst3_plugin_name, #name); \
|
||||||
do { \
|
return false; \
|
||||||
MAYBE_LOAD_FUNCTION(name); \
|
} \
|
||||||
if (!(name)) { \
|
|
||||||
log_failing_dlsym(yabridge_vst3_plugin_name, #name); \
|
|
||||||
return false; \
|
|
||||||
} \
|
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
LOAD_FUNCTION(yabridge_module_init);
|
LOAD_FUNCTION(yabridge_module_init);
|
||||||
LOAD_FUNCTION(yabridge_module_free);
|
LOAD_FUNCTION(yabridge_module_free);
|
||||||
LOAD_FUNCTION(yabridge_module_get_plugin_factory);
|
LOAD_FUNCTION(yabridge_module_get_plugin_factory);
|
||||||
MAYBE_LOAD_FUNCTION(remote_yabridge_version);
|
|
||||||
|
// This one can be a null pointer if the function does not yet exist in this
|
||||||
|
// yabridge version
|
||||||
|
remote_yabridge_version =
|
||||||
|
reinterpret_cast<decltype(remote_yabridge_version)>(
|
||||||
|
dlsym(library_handle, "yabridge_version"));
|
||||||
|
|
||||||
#undef LOAD_FUNCTION
|
#undef LOAD_FUNCTION
|
||||||
#undef MAYBE_LOAD_FUNCTION
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user