I got frustrated trying to figure out the c-for-go side of things, so I 
wrote my own lightweight wrapper over the vulkan API. Instead of trying to 
reverse engineer the c header files, I started with their published XML 
specification. https://github.com/ibd1279/vks

Jmw

On Saturday, November 13, 2021 at 10:42:24 PM UTC+1 Jason Watson wrote:

> Does anyone know how to configure c-for-go to work with output function 
> parameters - specifically slices?
>
> I was trying to play around with adding some vulkan 1.1 and vulkan 1.2 
> bindings to the vulkan-go bindings (github.com/vulkan-go/vulkan), but in 
> order to regenerate the bindings, I needed to use c-for-go (
> github.com/xlab/c-for-go). After struggling to get the local instance to 
> work, I realized that c-for-go is generating different helper functions 
> than when vulkan was previously checked-in.
>
> After digging a bit further, it looks like c-for-go now copies slices that 
> are "arr" hinted before passing them to C. As a result, a nil slice is 
> copied into an empty slice when crossing the membrane and not NULL. 
> Additionally, if the C function is expecting to populate the slice ( e.g. 
> https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/vkEnumeratePhysicalDevices.html
>  
> ), the results are lost as they are populated into the copied slice, and 
> not copied back into the original slice.
>
> The only way I've been able to get it to work is by configuring it as a 
> pointer and removing the slice header before hand, but I was curious if 
> anyone else was using c-for-go and had other solutions or configuration 
> tricks that I don't know as a c-for-go newbie.
>
> Jmw
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/dfd47bf1-4235-443c-8a85-46c77d88eba6n%40googlegroups.com.

Reply via email to