Hi there,

I’m trying to do some native windows rust programming. I’m using native-windows-gui and native-windows-derive to do it, but if I try to mix that with tokio, I get the following:

No entry point found error for GetWindowSubclass. On console, I get:

error: process didn't exit successfully: `C:\source\myprojectanem\target\debug\myprojectname.exe` (exit code: 0xc0000139, STATUS_ENTRYPOINT_NOT_FOUND)

If I change

#[tokio::main]
async fn main() {

to:

fn main() {

The problem goes away, but obviously I can’t use tokio then.

Any clue what the problem is and how to fix it?

  • cbarrick@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    1
    ·
    edit-2
    1 year ago

    You can manually convert a tokio::main to a regular main by constructing a tokio runtime and telling it to block on a top-level future (e.g. an async block).

    https://tokio.rs/tokio/tutorial/hello-tokio

    That will at least help you break down the problem to locate the issue.

    I don’t know anything about Windows though. Maybe there’s some per-thread setup that needs to be done in tokio’s thread pool?

    • modulus@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Same erro by using this approach.

      Tokio works fine, by itself. windows-native-gui works fine, by itself. It is the combination that causes this issue.