From 5d8657ceeb50ec4d55eeb56508b69944e95e9268 Mon Sep 17 00:00:00 2001 From: Lori Li Date: Wed, 14 May 2025 18:38:10 -0700 Subject: [PATCH 1/2] Fix ok interface mismatch --- rust-hdl-ok-frontpanel-sys/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-hdl-ok-frontpanel-sys/src/lib.rs b/rust-hdl-ok-frontpanel-sys/src/lib.rs index f9777d2a..afd39de9 100644 --- a/rust-hdl-ok-frontpanel-sys/src/lib.rs +++ b/rust-hdl-ok-frontpanel-sys/src/lib.rs @@ -126,7 +126,7 @@ impl OkHandle { } pub fn set_wire_in(&self, addr: i32, val: u16) { - unsafe { okFrontPanel_SetWireInValue(self.hnd, addr, val as u64, 0xFFFF) }; + unsafe { okFrontPanel_SetWireInValue(self.hnd, addr, val as u32, 0xFFFF) }; } pub fn update_wire_ins(&self) { From 8489d0084d2d69f48f1daa74795f39abbc4d81d9 Mon Sep 17 00:00:00 2001 From: Lori Li Date: Thu, 15 May 2025 10:46:34 -0700 Subject: [PATCH 2/2] Fix linker error --- rust-hdl-ok-frontpanel-sys/build.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rust-hdl-ok-frontpanel-sys/build.rs b/rust-hdl-ok-frontpanel-sys/build.rs index 4151ef2a..0d95356a 100644 --- a/rust-hdl-ok-frontpanel-sys/build.rs +++ b/rust-hdl-ok-frontpanel-sys/build.rs @@ -3,18 +3,19 @@ extern crate bindgen; use std::path::PathBuf; fn main() { - println!("cargo:rustc-link-lib=dylib=okFrontPanel"); let root_path = PathBuf::from(std::env::var("OK_FRONTPANEL_DIR").expect( "Set OK_FRONTPANEL_DIR to absolute path of the FrontPanel/API directory on this system", )); println!("cargo:rustc-link-lib=dylib=okFrontPanel"); + + let lib_path = root_path.join("lib").join("x64"); println!( "cargo:rustc-link-search=native={}", - root_path.to_str().unwrap() + lib_path.to_str().unwrap() ); let bindings = bindgen::Builder::default() - .header(root_path.join("okFrontPanel.h").to_str().unwrap()) + .header(root_path.join("include").join("okFrontPanel.h").to_str().unwrap()) .generate() .expect("Unable to generate bindings"); @@ -22,4 +23,4 @@ fn main() { bindings .write_to_file(out_path.join("bindings.rs")) .expect("Couldn't write bindings!"); -} +} \ No newline at end of file