From 2c422c2841f24be9a3fb65b1bf090bc847bae2b4 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Sat, 30 Oct 2021 00:21:27 -0600 Subject: ..what is even fucking happening --- src/lib.rs | 29 ++++++++++++++++++++--------- src/wx-sys.cpp | 6 ++++++ src/wx-sys.h | 4 ++++ 3 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 src/wx-sys.cpp create mode 100644 src/wx-sys.h (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index dca544b..44af2fe 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,20 @@ -#![allow( - non_camel_case_types, - non_snake_case, - unaligned_references, - non_upper_case_globals, - deref_nullptr -)] - -include!(concat!(env!("OUT_DIR"), "/bindings.rs")); +#[cxx::bridge] +mod ffi { + unsafe extern "C++" { + include!("shit-wx-sys/src/wx-sys.h"); + + fn message_box(); + } +} + +pub use ffi::*; + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_message_box() { + message_box(); + } +} diff --git a/src/wx-sys.cpp b/src/wx-sys.cpp new file mode 100644 index 0000000..8e07962 --- /dev/null +++ b/src/wx-sys.cpp @@ -0,0 +1,6 @@ +#include "shit-wx-sys/src/wx-sys.h" +#include + +void message_box() { + wxMessageBox("Hello World!!!"); +} diff --git a/src/wx-sys.h b/src/wx-sys.h new file mode 100644 index 0000000..68c4484 --- /dev/null +++ b/src/wx-sys.h @@ -0,0 +1,4 @@ +#include "rust/cxx.h" +#include + +void message_box(); -- cgit v1.2.3