I’m not having luck searching for this, though there’s a good chance it was in ziglings and I’ve simply forgotten.
I’m using Vulkan as a system library and pulling it in via translate_c with Zig 0.17.0. It produced this function signature:
pub extern fn vkEnumeratePhysicalDevices(instance: VkInstance, pPhysicalDeviceCount: [*c]u32, pPhysicalDevices: [*c]VkPhysicalDevice) VkResult;
I’m confused what the [*c] means though. Is that just indicating that it’s supposed to be a pointer to the first item in an array?
This is how I eventually got it to compile, but it seems like there is probably a more idiomatic way to do it.
var devices = try allocator.alloc(vulkan.VkPhysicalDevice, device_count);
_ = vulkan.vkEnumeratePhysicalDevices(instance, &device_count, @ptrCast(&devices[0]));
Thank you in advance for your help!