Marshaling memory between C and CGO (free/malloc)
I am working on a project where i have a C application that needs to call an sdk that is written in Go. We have created a wrapper DLL that we can invoke from our C application. However, the marshaling of non-primitives has me a bit stumped.
How to convert go pointer to c pointer
I’m newer to go and I’m trying to pass a pointer to some C code so that it can call a method with that pointer and I can access that pointer again. Here is a simple example of what I’m trying to do:
cgo complains when passing a struct with a slice of strings to a c function
I am learning go and cgo and ffi, I have the header file below:
How to pass a C function pointer around in go
I can pass a C function pointer to a C function, but passing it to a go function gives invalid operation.
Are the memory address segments of go and cgo isolated?
enter image description here
Does disabling GC make CGO callbacks safe?
I’m integrating a c library into my go program, and one of the functions I have to use have a callback interface. As is common with these, the function in question also takes a pointer, that it will pass you as a parameter when it calls the callback.
Is there an option to view executed C compiler commands in cgo?
While cross-compiling a Go project for ARM on FreeBSD I came across a few errors that don’t make sense, for example unsupported option -mno-thumb
or unused option -marm
. I suspect that there is potentially a bug in the tool that compiles C code.
cgo: cannot parse $WORK/b046/_cgo_.o as ELF, Mach-O, PE or XCOFF
What’s the issue? I want to connect Go to NodeJS using napi-go. When I run go build -buildmode=c-shared -o “example.node” . this is the error I get: cgo: cannot parse $WORK/b046/_cgo_.o as ELF, Mach-O, PE or XCOFF Expected An “example.node” file should be created which can be required in the index.js file. Repository Here is […]