Last active
February 13, 2020 02:49
-
-
Save richo/9454b822316c70bc0e754a7f9ca62611 to your computer and use it in GitHub Desktop.
cbindgen thingy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/target | |
**/*.rs.bk | |
Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "free-thingy" | |
version = "0.1.0" | |
authors = ["Richo Healey <[email protected]>"] | |
edition = "2018" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
header = "/* c bindings to the authlib-rs library */" | |
# include_guard = "AUTHLIB_RS_BINDINGS_H" | |
language = "C" | |
[parse.expand] | |
crates = ["free-thingy"] | |
[enum] | |
rename_variants = "QualifiedScreamingSnakeCase" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nightly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub struct TokenSet; | |
macro_rules! make_free_fn { | |
($name:ident, $ty:ident) => { | |
#[no_mangle] | |
pub unsafe extern "C" fn $name(ptr: *mut $ty) { | |
if ptr.is_null() { | |
return; | |
} | |
Box::from_raw(ptr); | |
} | |
} | |
} | |
make_free_fn!(tokenset, TokenSet); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment