diff --git a/crates/macro/src/lib.rs b/crates/macro/src/lib.rs index b0fb9454..026ab1f3 100644 --- a/crates/macro/src/lib.rs +++ b/crates/macro/src/lib.rs @@ -141,7 +141,10 @@ pub fn js_function(attr: RawStream, input: RawStream) -> RawStream { use std::ffi::CString; use napi::{Env, Error, Status, NapiValue, NapiRaw, CallContext}; let mut argc = #arg_len_span as usize; - let mut raw_args: [napi::sys::napi_value; #arg_len_span] = [ptr::null_mut(); #arg_len_span]; + #[cfg(all(target_os = "windows", target_arch = "x86"))] + let mut raw_args = vec![ptr::null_mut(); #arg_len_span]; + #[cfg(not(all(target_os = "windows", target_arch = "x86")))] + let mut raw_args = [ptr::null_mut(); #arg_len_span]; let mut raw_this = ptr::null_mut(); unsafe { @@ -157,6 +160,9 @@ pub fn js_function(attr: RawStream, input: RawStream) -> RawStream { } let mut env = unsafe { Env::from_raw(raw_env) }; + #[cfg(all(target_os = "windows", target_arch = "x86"))] + let ctx = CallContext::new(&mut env, cb_info, raw_this, raw_args.as_slice(), argc); + #[cfg(not(all(target_os = "windows", target_arch = "x86")))] let ctx = CallContext::new(&mut env, cb_info, raw_this, &raw_args, argc); #execute_js_function }