Skip to content

Compilation error for rust-hdl-ok-frontpanel-sys #48

Description

@loriiiiiiiii

Environment:

  • Windows 11 24H2
  • rust-hdl-ok-frontpanel-sys v0.46
  • FrontPanel SDK v5.3.6

Error msg:

error[E0308]: mismatched types
      --> C:\Users\LoriLi\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\rust-hdl-ok-frontpanel-sys-0.46.0\src\lib.rs:129:62
       |
129    |         unsafe { okFrontPanel_SetWireInValue(self.hnd, addr, val as u64, 0xFFFF) };
       |                  ---------------------------                 ^^^^^^^^^^ expected `u32`, found `u64`
       |                  |
       |                  arguments to this function are incorrect
       |
note: function defined here
      --> C:\Users\LoriLi\Documents\GitHub\hdl_test\target\debug\build\rust-hdl-ok-frontpanel-sys-4c239c464127879b\out/bindings.rs:177673:12
       |
177673 |     pub fn okFrontPanel_SetWireInValue(
       |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
177676 |         val: ::std::os::raw::c_ulong,
       |         ---
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
       |
129    |         unsafe { okFrontPanel_SetWireInValue(self.hnd, addr, (val as u64).try_into().unwrap(), 0xFFFF) };
       |                                                              +          +++++++++++++++++++++

For more information about this error, try `rustc --explain E0308`.
error: could not compile `rust-hdl-ok-frontpanel-sys` (lib) due to 1 previous error

Related file:
okFrontPanel.h

okFrontPanel_SetWireInValue(okFrontPanel_HANDLE hnd, int ep, unsigned long val, unsigned long mask);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions