native-windows-gui
native-windows-gui copied to clipboard
STATUS_ENTRYPOINT_NOT_FOUND if clap is imported
If I just try to import clap, the program fails to execute.
Minimal example:
#![windows_subsystem = "windows"]
extern crate native_windows_gui as nwg;
extern crate native_windows_derive as nwd;
use nwd::NwgUi;
use nwg::NativeUi;
use clap;
#[derive(Default, NwgUi)]
pub struct AboutMain {
#[nwg_control(size: (300, 115), position: (300, 300), title: "About", flags: "WINDOW|VISIBLE")]
#[nwg_events( OnWindowClose: [AboutMain::say_goodbye] )]
window: nwg::Window,
#[nwg_layout(parent: window, spacing: 1)]
grid: nwg::GridLayout,
#[nwg_control(text: "Heisenberg", focus: true)]
#[nwg_layout_item(layout: grid, row: 0, col: 0)]
name_edit: nwg::TextInput,
#[nwg_control(text: "Say my name")]
#[nwg_layout_item(layout: grid, col: 0, row: 1, row_span: 2)]
#[nwg_events( OnButtonClick: [AboutMain::say_hello] )]
hello_button: nwg::Button
}
impl AboutMain {
fn say_hello(&self) {
nwg::modal_info_message(&self.window, "Hello", &format!("Hello {}", self.name_edit.text()));
}
fn say_goodbye(&self) {
nwg::modal_info_message(&self.window, "Goodbye", &format!("Goodbye {}", self.name_edit.text()));
nwg::stop_thread_dispatch();
}
}
pub fn run() {
nwg::init().expect("Failed to init Native Windows GUI");
nwg::Font::set_global_family("Segoe UI").expect("Failed to set default font");
let _app = AboutMain::build_ui(Default::default()).expect("Failed to build UI");
nwg::dispatch_thread_events();
}
fn main() {
run();
}
If I comment the use clap;, then the program works as expected.
Here is the error:
warning: unused import: `clap`
--> src\main.rs:9:5
|
9 | use clap;
| ^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: `nwg-clap-minimal` (bin "nwg-clap-minimal") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 0.08s
Running `target\debug\nwg-clap-minimal.exe`
error: process didn't exit successfully: `target\debug\nwg-clap-minimal.exe` (exit code: 0xc0000139, STATUS_ENTRYPOINT_NOT_FOUND)
This happens with both derive or cargo features of clap.
If using the tokio library and enabling the "process" feature, there will also be a STATUS_ENTRYPOINT_NOT_FOUND. cargo.toml:
[dependencies]
native-windows-derive = "1.0.5"
native-windows-gui = "1.0.13"
tokio = { version = "1.35.1", features = ["rt", "rt-multi-thread", "macros", "sync", "time",
"process",
] }
Run it:
cargo run
Finished dev [unoptimized + debuginfo] target(s) in 9.78s
Running target\debug\test01.exe
error: process didn't exit successfully: target\debug\test01.exe (exit code: 0xc0000139, STATUS_ENTRYPOINT_NOT_FOUND)