I thought you might Im writing many wrapper functions to C functions that take multiple C.char*. All of these require a defer statement to free the C string when the wrapper function terminates. Im absolutely sure Im going to miss one or more of these out, so I was wondering if I could get hold of the defer list, then I could encapsulate the construction with the defer in a function.
e.g. roughly : func NewCString(s string, deferList List) *C.char { cs := C.CString(s) deferList.PushBack(func() { C.free(cs) } return cs } Then in an imagined world I could write my wrapper as : func wrapper(s1 string, s2 string, s3 string) { deferList := runtime.DeferList() return C.inner(NewCString(s1,deferList) } On Wednesday, October 19, 2016 at 8:41:25 PM UTC+1, Pietro Gagliardi (andlabs) wrote: > > What do you want to do with it? > > -- 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. For more options, visit https://groups.google.com/d/optout.