CapSoftware / scap

High-performance, cross-platform screen capture library in Rust.
https://crates.io/crates/scap
Other
229 stars 44 forks source link

mismatched types on win11 #112

Closed daidi closed 2 weeks ago

daidi commented 3 months ago
error[E0308]: mismatched types                              
   --> C:\Users\Dorothy\.cargo\git\checkouts\scap-4f4d5464a703bac2\fa776e0\src\capturer\engine\win\mod.rs:156:42
    |
156 |             WCMonitor::from_raw_hmonitor(display.raw_handle.0),
    |             ---------------------------- ^^^^^^^^^^^^^^^^^^^^ expected `*mut c_void`, found `isize`
    |             |
    |             arguments to this function are incorrect
    |
    = note: expected raw pointer `*mut c_void`
                      found type `isize`
note: associated function defined here
   --> C:\Users\Dorothy\.cargo\registry\src\mirrors.aliyun.com-8754fae0eb2f08f1\windows-capture-1.3.2\src\monitor.rs:440:18
    |
440 |     pub const fn from_raw_hmonitor(monitor: *mut std::ffi::c_void) -> Self {
    |                  ^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> C:\Users\Dorothy\.cargo\git\checkouts\scap-4f4d5464a703bac2\fa776e0\src\capturer\engine\win\mod.rs:166:37
    |
166 |             WCWindow::from_raw_hwnd(window.raw_handle.0),
    |             ----------------------- ^^^^^^^^^^^^^^^^^^^ expected `*mut c_void`, found `isize`
    |             |
    |             arguments to this function are incorrect
    |
    = note: expected raw pointer `*mut c_void`
                      found type `isize`
note: associated function defined here
   --> C:\Users\Dorothy\.cargo\registry\src\mirrors.aliyun.com-8754fae0eb2f08f1\windows-capture-1.3.2\src\window.rs:227:18
    |
227 |     pub const fn from_raw_hwnd(hwnd: *mut std::ffi::c_void) -> Self {
    |                  ^^^^^^^^^^^^^

error[E0308]: mismatched types
     --> C:\Users\Dorothy\.cargo\git\checkouts\scap-4f4d5464a703bac2\fa776e0\src\targets\win\mod.rs:21:34
      |
21    |             raw_handle: HMONITOR(display.as_raw_hmonitor()),
      |                         -------- ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `*mut c_void`
      |                         |
      |                         arguments to this struct are incorrect
      |
      = note:     expected type `isize`
              found raw pointer `*mut c_void`
note: tuple struct defined here
     --> C:\Users\Dorothy\.cargo\registry\src\mirrors.aliyun.com-8754fae0eb2f08f1\windows-0.52.0\src\Windows\Win32\Graphics\Gdi\mod.rs:12724:12
      |
12724 | pub struct HMONITOR(pub isize);
      |            ^^^^^^^^

error[E0308]: mismatched types                              
     --> C:\Users\Dorothy\.cargo\git\checkouts\scap-4f4d5464a703bac2\fa776e0\src\targets\win\mod.rs:35:30
      |
35    |             raw_handle: HWND(window.as_raw_hwnd()),
      |                         ---- ^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `*mut c_void`
      |                         |
      |                         arguments to this struct are incorrect
      |
      = note:     expected type `isize`
              found raw pointer `*mut c_void`
note: tuple struct defined here
     --> C:\Users\Dorothy\.cargo\registry\src\mirrors.aliyun.com-8754fae0eb2f08f1\windows-0.52.0\src\Windows\Win32\Foundation\mod.rs:11094:12
      |
11094 | pub struct HWND(pub isize);
      |            ^^^^

error[E0308]: mismatched types
     --> C:\Users\Dorothy\.cargo\git\checkouts\scap-4f4d5464a703bac2\fa776e0\src\targets\win\mod.rs:50:30
      |
50    |         raw_handle: HMONITOR(display.as_raw_hmonitor()),
      |                     -------- ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `*mut c_void`
      |                     |
      |                     arguments to this struct are incorrect
      |
      = note:     expected type `isize`
              found raw pointer `*mut c_void`
note: tuple struct defined here
     --> C:\Users\Dorothy\.cargo\registry\src\mirrors.aliyun.com-8754fae0eb2f08f1\windows-0.52.0\src\Windows\Win32\Graphics\Gdi\mod.rs:12724:12
      |
12724 | pub struct HMONITOR(pub isize);
      |            ^^^^^^^^

error[E0308]: mismatched types
   --> C:\Users\Dorothy\.cargo\git\checkouts\scap-4f4d5464a703bac2\fa776e0\src\targets\win\mod.rs:97:54
    |
97  |             let monitor = Monitor::from_raw_hmonitor(display.raw_handle.0);
    |                           -------------------------- ^^^^^^^^^^^^^^^^^^^^ expected `*mut c_void`, found `isize`
    |                           |
    |                           arguments to this function are incorrect
    |
    = note: expected raw pointer `*mut c_void`
                      found type `isize`
note: associated function defined here
   --> C:\Users\Dorothy\.cargo\registry\src\mirrors.aliyun.com-8754fae0eb2f08f1\windows-capture-1.3.2\src\monitor.rs:440:18
    |
440 |     pub const fn from_raw_hmonitor(monitor: *mut std::ffi::c_void) -> Self {
    |                  ^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `scap` (lib) due to 6 previous errors
warning: build failed, waiting for other jobs to finish...
Brendonovich commented 2 weeks ago

Fixed by #120