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/7303ad9e-ebf3-4db3-81b5-90ae6021af74n%40googlegroups.com.

Reply via email to