Skip to content

Commit 0244086

Browse files
committed
Use runtime clang-sys feature to match cpal
I was getting the following `clang-sys` failure when using `vst3-bindgen` in a crate that also depends on `cpal`: ``` thread 'main' panicked at 'a `libclang` shared library is not loaded on this thread', /Users/kevin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/clang-sys-1.6.1/src/lib.rs:1735:1 ``` I think `cpal`'s transitive dependency on `clang-sys` enables the runtime feature, also enabling it for `com-scrape`'s usage of `clang-sys`. But `clang_sys::load()` must be called when the runtime feature is enabled.
1 parent f17c2bc commit 0244086

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

com-scrape/Cargo.toml

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
[package]
2-
name = "com-scrape"
3-
version = "0.1.0"
4-
authors = ["Micah Johnston <[email protected]>"]
5-
edition = "2021"
6-
description = "Automatically generates Rust bindings for COM interfaces"
7-
repository = "https://github.com/coupler-rs/vst3-bindgen"
8-
license = "MIT OR Apache-2.0"
9-
10-
[dependencies]
11-
clang-sys = { version = "1", features = ["clang_6_0"] }
1+
[package]
2+
name = "com-scrape"
3+
version = "0.1.0"
4+
authors = ["Micah Johnston <[email protected]>"]
5+
edition = "2021"
6+
description = "Automatically generates Rust bindings for COM interfaces"
7+
repository = "https://github.com/coupler-rs/vst3-bindgen"
8+
license = "MIT OR Apache-2.0"
9+
10+
[dependencies]
11+
clang-sys = { version = "1", features = ["clang_6_0", "runtime"] }

com-scrape/src/generator.rs

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pub struct Generator {
5353

5454
impl Generator {
5555
pub fn new() -> Self {
56+
clang_sys::load().unwrap();
5657
Generator {
5758
options: GeneratorOptions::default(),
5859
source: String::new(),

0 commit comments

Comments
 (0)