In this post, we will see how to resolve CGO: when should C.free() be used? Question: Question: shall I use C.free() to ensure that the code does not leak memory? I feel that this is not required as the variable ...

Question: I am running a go program in a kubernetes pod, and there is cgo usage in the app. The pod crashes, sometimes with a traceback, sometimes without. When there is a traceback, it points to GC tasks: Setting GODEBUG=cgocheck=2 ...

Question: In my project, I am using callbacks for bi-directional calls from C into go and vice versa using CGO. I resolved the issue of circular dependencies by compiling the C part into a library, then compiling the go part ...

Question: I have a lib, that uses some C on linux. On windows it is just a dummy noop lib with functions that do nothing. The lib is in 3 files: lib_linux.go, lib_win.go and lib.c But when I try to ...

Question: I needed to call Rust code from my Go code. Then I used C as my interface. I did this: I’ve created a Rust library that takes a CStr as a parameter, and returns a new processed string back ...