diff --git a/Changelog.md b/Changelog.md index 8749c4c..d653900 100644 --- a/Changelog.md +++ b/Changelog.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- examples: Use `c_char` for pointer to raw string (#521) - Device extension `khr::PipelineExecutableProperties` and `khr::TimelineSemaphore` now expose `fn device()` instead of `fn instance()` (#499) - Changed `khr::PipelineExecutableProperties::new()` and `khr::TimelineSemaphore::new()` to take `instance` and `device` as arguments (#499) diff --git a/examples/src/lib.rs b/examples/src/lib.rs index 59be917..b3e19bf 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -13,6 +13,7 @@ use std::cell::RefCell; use std::default::Default; use std::ffi::{CStr, CString}; use std::ops::Drop; +use std::os::raw::c_char; use winit::{ event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent}, @@ -219,8 +220,10 @@ impl ExampleBase { let entry = Entry::new(); let app_name = CString::new("VulkanTriangle").unwrap(); - let layer_names = [CString::new("VK_LAYER_KHRONOS_validation").unwrap()]; - let layers_names_raw: Vec<*const i8> = layer_names + let layer_names = [CStr::from_bytes_with_nul_unchecked( + b"VK_LAYER_KHRONOS_validation\0", + )]; + let layers_names_raw: Vec<*const c_char> = layer_names .iter() .map(|raw_name| raw_name.as_ptr()) .collect();