926 questions
1
vote
0
answers
68
views
Environment variables not accessible in dynamically loaded .dylib on macOS using Rust libloading, but works on Windows
macOS: The dynamically loaded .dylib cannot read environment variables that were set by the main Rust process at runtime
Windows: The same code works perfectly - the .dll can access environment ...
4
votes
0
answers
59
views
Failed to create thumbnail using the PTB_SaveAsImage function from the C API (In GO)
For testing the callas PDF toolbox SDK, I want to convert a sample PDF to a PNG. The callas license is activated.
In my main() function, I successfully initialize the SDK. After that, I call the ...
1
vote
1
answer
147
views
ctypes + cgo and ownership of strings
Background
I am currently using a DLL I generated with golang in python. As a sanity check for debugging I added a function called return_string(), which takes a pointer to a string in C (char*) ...
0
votes
1
answer
92
views
Deferring free on a parameter
I am working with cgo, I have a parameter that's being passed in as a *C.char. Once it's been used in a function call I no longer need it, so I defer freeing it, but when I do I don't get a result ...
1
vote
2
answers
127
views
Cross compiling a Go native binary for Java code using docker
I'm trying to compile a Go native binary to use in Java code on Mac. The binary needs to be executed on a linux host which has the following specifications:
# uname -a
Linux <hostname> 5.14.0-...
3
votes
1
answer
178
views
Zig as C Linux->Mac cross-compiler for go project with go-sqlite3 error: unable to find dynamic system library 'resolv'
I'm building a Go application with native (CGO_ENABLED=1) SQLite support using https://github.com/mattn/go-sqlite3.
I'm trying to get the builder docker image to a reasonable size. (goreleaser/...
2
votes
1
answer
72
views
How to process mismatch C & Go structure issue when Go process C written file format?
I have a file written in C with the format "header.h", and I want to read it using CGO to automatically retrieve the field names defined in header.h.
Here is a shortened example where I ...
0
votes
1
answer
106
views
Golang ImageMagick Leftover Threads
I have written a linux service in Go that processes a large number of image files, converting them from TIFF to JPEG and adding a text overlay on top. I'm using the Go package gographics/imagick/v3 ...
2
votes
1
answer
142
views
Calling a static C/C++ library from Go
I'm still on the learning curve with Go, but I've managed to compile and run a Go program that includes a C object file.
The objective is to call an existing static C++ library. The call will be a bit ...
0
votes
0
answers
318
views
golang and C with SIMD instructions
I am quite new to golang, and I am doing some experiments with golang and cgo. I wanted to see if golang can benefit with a C program that uses SIMD operations on a simple test, however what I saw is ...
2
votes
0
answers
80
views
Unable to get the c stack trace with a corefile from a cgo routine
I'm using https://github.com/gen2brain/aac-go.git to encode AAC in my golang project, but sometimes I got crash in my ARMV7l linux and I have executed like CGO_DEBUG=1 GOTRACEBACK=crash ./binary to ...
0
votes
0
answers
124
views
Go CGO: Binary doesn't find shared library with rpath, only works with LD_LIBRARY_PATH
I am working on a GO project that links to a shared library (.so) using CGO. I want to embed the library path in the binary using rpath,so that it runs without needing to set the LD_LIBRARY_PATH. ...
1
vote
1
answer
130
views
cant run go code with sqlite3 on windows but works fine on linux
I have to switch to windows for a week and I cant run my project
I installed GCC via Cygwin and added it to path, I can call it from any shell. I set CGOENABLED=1 because it was required but I keep ...
3
votes
0
answers
50
views
Go Mobile Performance: Regular CPU Usage Gaps on iOS
I'm encountering an interesting performance pattern when running a Go benchmark on iOS using gomobile. The CPU usage shows regular gaps of 30ms and 40ms between execution periods when monitored using ...
0
votes
1
answer
38
views
Code written in golang, output as a C dynamic library, is called by posgres17, but Golang-generated dynamic library functions is blocked
everyone:
I wrote a demo, but it doesn't work properly, can you help me, thank you very much.
Code written in golang, output as C dynamic library "libtest1.so", is called by the "...