Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use C-unwind in bindgen, mandatory as of rust 1.81 #11

Merged
merged 1 commit into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/byondapi-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fn extract_args(a: &syn::FnArg) -> &syn::PatType {
#[allow(clippy::test_attr_in_doctest)]
/// Macro for generating byond binds
/// Usage:
/// ```
/// ```ignore
/// use byondapi::prelude::*;
/// #[byondapi::bind]
/// fn example() {Ok(ByondValue::null())}
Expand All @@ -23,7 +23,7 @@ fn extract_args(a: &syn::FnArg) -> &syn::PatType {
///
/// ```
/// Then generate the bindings.dm file with
/// ```
/// ```ignore
/// #[test]
/// fn generate_binds() {
/// byondapi::byondapi_macros::generate_bindings(env!("CARGO_CRATE_NAME"));
Expand Down
4 changes: 2 additions & 2 deletions crates/byondapi-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "byondapi"
version = "0.4.8"
version = "0.4.9"
authors = ["tigercat2000 <[email protected]>"]
edition = "2021"
description = "Idiomatic Rust bindings for BYONDAPI"
Expand All @@ -13,7 +13,7 @@ exclude = [".vscode/*"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
byondapi-sys = { path = "../byondapi-sys", version = "0.11.1" }
byondapi-sys = { path = "../byondapi-sys", version = "0.11.2" }
byondapi-macros = { path = "../byondapi-macros", version = "0.1.2" }
libloading = "0.8.4"
inventory = "0.3.15"
Expand Down
4 changes: 3 additions & 1 deletion crates/byondapi-rs/src/threadsync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ struct CallbackData<F: FnOnce() -> ByondValue + Send> {
callback: Option<F>,
}

extern "C" fn trampoline<F: FnOnce() -> ByondValue + Send>(data: *mut c_void) -> CByondValue {
extern "C-unwind" fn trampoline<F: FnOnce() -> ByondValue + Send>(
data: *mut c_void,
) -> CByondValue {
let data = unsafe { Box::from_raw(data as *mut CallbackData<F>) };
(data.callback.unwrap())().into_inner()
}
Expand Down
2 changes: 1 addition & 1 deletion crates/byondapi-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "byondapi-sys"
version = "0.11.1"
version = "0.11.2"
authors = ["tigercat2000 <[email protected]>"]
edition = "2021"
description = "Raw bindgen bindings for byondapi"
Expand Down
3 changes: 2 additions & 1 deletion crates/byondapi-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use bindgen::callbacks::ParseCallbacks;
use bindgen::{callbacks::ParseCallbacks, Abi};
use std::path::{Path, PathBuf};

fn main() {
Expand Down Expand Up @@ -55,6 +55,7 @@ fn generate_all() {
.header(wrapper.to_string_lossy())
.dynamic_library_name("ByondApi")
.dynamic_link_require_all(true)
.override_abi(Abi::CUnwind, "Byond.*")
// Also make headers included by main header dependencies of the build
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.parse_callbacks(Box::new(DoxygenCallbacks));
Expand Down
Loading