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 ash' built-in "linked" feature for static linking #84

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ build = "build/build.rs"
# in this range, not just the start and the end, to be sure it's compatible.
version = ">=0.35, <=0.37"
default-features = false
features = ["linked"]

[build-dependencies]
anyhow = "1.0"
Expand Down
18 changes: 2 additions & 16 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
use ash::{vk, Entry};
use ash::Entry;

extern "system" {
fn vkGetInstanceProcAddr(
instance: vk::Instance,
p_name: *const std::os::raw::c_char,
) -> vk::PFN_vkVoidFunction;
}

/// Fetches the function pointer to `vkGetInstanceProcAddr` which is statically linked.
pub fn load() -> Entry {
let static_fn = vk::StaticFn {
get_instance_proc_addr: vkGetInstanceProcAddr,
};
#[allow(unsafe_code)]
unsafe {
Entry::from_static_fn(static_fn)
}
Entry::linked()
}
Loading