In a program, I have a function that takes in a string argument, and returns a string in which len(resultString)
could potentially be 4 * len(argumentString)
. This is because I am using Cgo
with a C-file that I have imported into my project, and this C function requires a char *
that is 4 times the original length of a string.
Is there an 'efficient' way of initializing and converting a go string to a C string? Because right now I am initializing a byte array in Go, and then string
ing that, and then calling C.CString
on that string. This ultimately is causing some performance issues if the length of the string is large enough. Thanks!