Skip to content

Commit

Permalink
Fix bugs (#2)
Browse files Browse the repository at this point in the history
* Added assert to ptr unboxing

* Specified minimum version of  package.

* version numbering

---------

Co-authored-by: Timo Betcke <[email protected]>
  • Loading branch information
mscroggs and tbetcke authored Nov 25, 2024
1 parent 07206c2 commit 9664159
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ strict = []

[package]
name = "c-api-tools"
version = "0.1.0-dev"
version = "0.0.0-dev"
edition = "2021"
authors = [
"Timo Betcke <[email protected]>",
Expand Down
4 changes: 2 additions & 2 deletions c-api-tools-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ strict = []

[package]
name = "c-api-tools-macros"
version = "0.1.3-dev"
version = "0.0.0-dev"
edition = "2021"
authors = [
"Matthew Scroggs <[email protected]>",
Expand All @@ -22,7 +22,7 @@ name = "c_api_tools_macros"
proc-macro = true

[dependencies]
syn = "2.0"
syn = ">=2.0.87"
proc-macro2 = "1.0"
darling = "0.20"
quote = "1.0"
Expand Down
1 change: 1 addition & 0 deletions c-api-tools-macros/src/attribute_concretise_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ pub(crate) fn concretise_type_impl(args: TokenStream, item: TokenStream) -> Toke
#block

#(
assert!(! #idents.is_null());
let #idents = &(*#idents)._ptr;
)*

Expand Down
2 changes: 2 additions & 0 deletions example_project/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ typedef struct MyWrapper MyWrapper;
struct MyWrapper *my_wrapper_create(void);

void my_wrapper_free(struct MyWrapper *ptr);

void test_func(struct MyWrapper *spam);

0 comments on commit 9664159

Please sign in to comment.