xlab / c-for-go

Automatic C-Go Bindings Generator for Go Programming Language
https://c.for-go.com
MIT License
1.5k stars 119 forks source link

add an optional expression which can be used to default a slice length #149

Closed jstrachan closed 1 year ago

jstrachan commented 1 year ago

you can add a configuration in the yaml file for the expression to use:

TRANSLATOR:
  LenFields:
    MyStruct.some_data: some_size

which will then generate the go code to set the Len of the slice in the Deref() function

xlab commented 1 year ago

Awesome idea, thanks!