1
0
Fork 0

Register the loggers for VST3 and CLAP plugins

This commit is contained in:
Robbert van der Helm 2022-04-24 15:24:35 +02:00
parent 5ae0bee3ee
commit 015c554d79
4 changed files with 7 additions and 8 deletions

View file

@ -7,3 +7,6 @@ pub(crate) mod util;
#[cfg(feature = "vst3")]
pub mod vst3;
// This is used by the wrappers.
pub use util::setup_logger;

View file

@ -29,8 +29,8 @@ macro_rules! nih_export_clap {
static ref FACTORY: ::nih_plug::wrapper::clap::Factory<$plugin_ty> = ::nih_plug::wrapper::clap::Factory::default();
}
// We don't need any special initialization or deinitialization handling
pub extern "C" fn init(_plugin_path: *const ::std::os::raw::c_char) -> bool {
::nih_plug::wrapper::setup_logger();
true
}

View file

@ -56,10 +56,6 @@ pub fn strlcpy(dest: &mut [c_char], src: &str) {
/// `OutputDebugString()`.
/// - A file path, in which case the output gets appended to the end of that file which will be
/// created if necessary.
///
/// # TODO
///
/// Document `NIH_LOG` in an easier to find place.
pub fn setup_logger() {
// `win_dbg_logger` has no way to let us know that the logger has already been set up, so we'll
// need to do it this way

View file

@ -23,15 +23,13 @@ macro_rules! nih_export_vst3 {
Box::into_raw(factory) as *mut ::std::ffi::c_void
}
// We don't need any special initialization logic, so all of these module entry point
// functions just return true all the time
// These two entry points are used on Linux, and they would theoretically also be used on
// the BSDs:
// https://github.com/steinbergmedia/vst3_public_sdk/blob/c3948deb407bdbff89de8fb6ab8500ea4df9d6d9/source/main/linuxmain.cpp#L47-L52
#[no_mangle]
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
pub extern "C" fn ModuleEntry(_lib_handle: *mut ::std::ffi::c_void) -> bool {
::nih_plug::wrapper::setup_logger();
true
}
@ -46,6 +44,7 @@ macro_rules! nih_export_vst3 {
#[no_mangle]
#[cfg(target_os = "macos")]
pub extern "C" fn bundleEntry(_lib_handle: *mut ::std::ffi::c_void) -> bool {
::nih_plug::wrapper::setup_logger();
true
}
@ -60,6 +59,7 @@ macro_rules! nih_export_vst3 {
#[no_mangle]
#[cfg(target_os = "windows")]
pub extern "system" fn InitDll() -> bool {
::nih_plug::wrapper::setup_logger();
true
}