warning: `extern` fn uses type `fn(*mut AEffect, i32, i32, isize, *mut c_void, f32) -> isize`, which is not FFI-safe
--> src\lib.rs:182:47
|
179 | pub extern "system" fn MAIN(callback: $crate::api::HostCallbackProc) -> *mut $crate::api::AEffect {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
...
325 | plugin_main!(TestPlugin);
| ------------------------- in this macro invocation
|
= note: `#[warn(improper_ctypes_definitions)]` on by default
= help: consider using an `extern fn(...) -> ...` function pointer instead
= note: this function pointer has Rust-specific calling convention
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
(same warning for VSTPluginMain)
The issue is that HostCallbackProc is defined without extern, defaulting to Rust calling convention:
We can't make HostCallbackProc instantiatable for different calling conventions, but what should we do about the warning?
Should we do anything about it, or just #[allow()] it?
We shouldn't silence the warning; it's incorrect for it not to be extern. But I believe it should just be extern "C" in all three cases. Anyway, #141 fixes this.
Running
cargo test
says:(same warning for
VSTPluginMain
)The issue is that
HostCallbackProc
is defined withoutextern
, defaulting to Rust calling convention:We have https://github.com/RustAudio/vst-rs/blob/3f88b991640c989eb3ed412c59bb87124a940dfb/src/lib.rs#L165-L186 so the calling conv of
HostCallbackProc
would have to be"system"
formain_macho
andMAIN
, but"C"
forVSTPluginMain
.We can't make
HostCallbackProc
instantiatable for different calling conventions, but what should we do about the warning? Should we do anything about it, or just#[allow()]
it?