Skip to main content
Filter by
Sorted by
Tagged with
5 votes
1 answer
107 views

I am trying to use the PETSc (Portable, Extensible Toolkit for Scientific Computation) library in Go over cgo. After the call of PetscInitialize, the program will crash at a random point with the ...
Fabian's user avatar
  • 81
2 votes
1 answer
186 views

I want to call a go function from C++ and return a string. The function: //export EditStr func EditStr(a string) (ostr string) { ostr = fmt.Sprintf("[["+a+"]]") fmt....
Raphael Grimm's user avatar
1 vote
0 answers
89 views

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 ...
leibuyun's user avatar
4 votes
0 answers
65 views

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 ...
donatellot_123's user avatar
1 vote
1 answer
158 views

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*) ...
Kieran Wood's user avatar
  • 1,481
0 votes
1 answer
92 views

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 ...
Kieran Wood's user avatar
  • 1,481
1 vote
2 answers
141 views

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-...
scottstots's user avatar
3 votes
1 answer
285 views

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/...
user3277119's user avatar
2 votes
1 answer
79 views

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 ...
Daniel YC Lin's user avatar
0 votes
1 answer
122 views

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 ...
Jim's user avatar
  • 45
2 votes
1 answer
221 views

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 ...
winwaed's user avatar
  • 7,820
0 votes
0 answers
374 views

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 ...
Ilian Zapryanov's user avatar
2 votes
0 answers
86 views

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 ...
Cat Tom's user avatar
  • 86
0 votes
0 answers
195 views

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. ...
ray an's user avatar
  • 1,280
1 vote
1 answer
192 views

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 ...
Vojin Purić's user avatar
  • 2,395
3 votes
0 answers
53 views

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 ...
yy l's user avatar
  • 41
0 votes
1 answer
43 views

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 "...
wgf098's user avatar
  • 9
1 vote
1 answer
107 views

When I want to create an instance of a struct, defined in another package then I get an IncompatibleAssign error. The project has following structure: def.go root/root.go In def.go a struct is ...
Martin Bammer's user avatar
0 votes
2 answers
119 views

Consider the following snippet in Go that uses cgo to wrap a C API: /* #include <myheader.h> void MyCall(my_type* a, my_type* b); */ import "C" // Go wrapper for native pointer ...
Theodore Tsirpanis's user avatar
2 votes
1 answer
84 views

I develop go pure go client for Windows Management Infrastructure (MI). It's the successor of WMI. While initialization works as indented package main import ( "unsafe" "...
jkroepke's user avatar
  • 140
1 vote
0 answers
64 views

I am working with an existing go code that uses #cgo parts. I am trying to make this code compile in a reproducible way in terms of the output binary (the same sha256/ md5 no matter in what dir it is ...
Łukasz Przeniosło's user avatar
1 vote
0 answers
38 views

I have a Go project that uses the C-APIs of a C Library, via the C-Go interface. After the project is built, it requires a .so file while its execution. So now when I want to ship the project's binary ...
Sanjiban Sengupta's user avatar
0 votes
1 answer
131 views

I'm trying to call a Go function from a C program. I have built a static library from my Go source, however, ld is unable to find the function I want to call from the C program. Go code: package main ...
MrMcGoats's user avatar
1 vote
0 answers
65 views

I am trying to build a go_binary that depends on com_github_pebbe_zmq4, a go wrapper of the libzmq in C++. I've been struggling to make pebbe/zmq4 "see" zmq.h in libzmq, and can't make it ...
HaiXin Tie's user avatar
  • 2,079
1 vote
0 answers
93 views

I have a typedef enum struct defined as such typedef enum struct EnumStructName : int { Val1, Val2, Val2 } EnumStructName; When I am compiling the C++ code on my Mac its working fine. And its ...
dg428's user avatar
  • 441
3 votes
0 answers
128 views

I'm developing using a third-party SDK, but I've encountered an issue related to CGO conversion. this C struct from third-party SDK, C struct typedef struct PicHead { unsigned short Flag; ...
zev3691's user avatar
  • 31
0 votes
1 answer
77 views

Following is my code, I hope go can capture c code's progress package main /* #cgo CFLAGS: -I/home/roroco/Downloads/go/test_cgo/submodule/test_cgo_cpp/include #cgo LDFLAGS: -L/home/roroco/Downloads/...
chikadance's user avatar
  • 4,195
1 vote
0 answers
136 views

I cannot build a cgo-based project targeting GOOS=wasip1. Here is github repository helping reproduction. Environment Go 1.22.4 Debian 12 Output of go env command goes as GO111MODULE='' GOARCH='...
sammyne's user avatar
  • 121
2 votes
0 answers
170 views

I'm working on a Go application that interfaces with Python via CGO to process store data. I'm using goroutines because I have more than 4M store. Issue: The execution gets blocked after some ...
sokida's user avatar
  • 531
1 vote
1 answer
275 views

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 ...
LeapOfFaith's user avatar
1 vote
0 answers
121 views

I go get portaudio go module. And try to run the examples. go build mp3.go And it reports # github.com/bobertlo/go-mpg123/mpg123 ../../../../go/pkg/mod/github.com/bobertlo/go-mpg123@xxx/mpg123/mpg123....
hankeyyh's user avatar
  • 139
1 vote
2 answers
220 views

I have golang code like: import ( "github.com/bobertlo/go-mpg123/mpg123" ) func main() { ... } From terminal, to build this code. I must set below env variable: export ...
hankeyyh's user avatar
  • 139
2 votes
0 answers
34 views

run C exe that linked with 2 GO dynamic link shared object . text "*Go code linked into, and called from, a non-Go program In this mode Go code acts as a library that may be called by a non-Go ...
Yuval Abadi's user avatar
0 votes
1 answer
166 views

I use following main.go call cpp lib so package main /* #cgo LDFLAGS: -L/home/roroco/Dropbox/cpp/cpp_lib/draft/go_call_cpp -lprogress #include "progress_lib.h" // Callback function to be ...
chikadance's user avatar
  • 4,195
1 vote
1 answer
65 views

Here is my structure. main.go with C signal handler (ref: handle signal with cgo, go cannot handle signal) use go build and run in docker (with -v /:/rootfs:ro in docker-compose.yml) Experiments: ...
WeiAnHsieh's user avatar
1 vote
0 answers
75 views

The main question - is it possible to have several Go runtimes linked dynamically into one binary and running in the one process? I have two Go libraries which are linked into one Swift app and after ...
Anton Shkindzer's user avatar
-2 votes
1 answer
135 views

I use the docker golang:1.22 for building my Go project for Windows x32/x64 and Linux x32/x64. I have installed: apt -y install build-essential apt -y install gcc-multilib apt -y install g++-multilib ...
Strunin Vadim's user avatar
0 votes
1 answer
236 views

Here is my main.go package main /* #include <stdio.h> #include <signal.h> #include <string.h> #include <stdlib.h> #include <unistd.h> // Global variable to store old ...
WeiAnHsieh's user avatar
1 vote
1 answer
172 views

I am learning go and cgo and ffi, I have the header file below: #include <stdarg.h> #include <stdbool.h> #include <stdint.h> #include <stdlib.h> typedef struct MyStruct3 { ...
masber's user avatar
  • 3,087
2 votes
1 answer
71 views

I'm writing on an encrypt for sql.DB connection, but have some problems in converting pointer between C and Go. Looks like sql.DB is not a simple struct in Go and have GoPointer, any chance can export ...
richardkiwilee's user avatar
3 votes
1 answer
50 views

I can pass a C function pointer to a C function, but passing it to a go function gives invalid operation. I have 100 go functions wrapping C functions and most share the same setup and arguments so I ...
Craftables's user avatar
0 votes
0 answers
121 views

I'm trying to launch gortsp example: https://github.com/bluenviron/gortsplib/blob/main/examples/client-play-format-h264. But I have a problem with h264_decoder.go: "exec: "pkg-config": ...
Nikita's user avatar
  • 19
0 votes
0 answers
62 views

everyone. Right now I'm writing my "scientific work" about fuzzing and I've got a problem with something in my fuzzing lib. I try to fuzz go-ethereum lib (specificly bn256 part of it): go-...
Степан Кафанов's user avatar
0 votes
0 answers
89 views

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 ...
sprw121's user avatar
  • 1,131
2 votes
1 answer
322 views

I'm trying to run this example I'm have an error "android/386 requires external (cgo) linking, but cgo is not enabled [android,386]" in terminal after: fyne package -os android -appID com....
Olek's user avatar
  • 21
2 votes
0 answers
268 views

I am using the LightGBM C Api in our ML model hosting service, written in Golang. I've written a CGO wrapper around the C Api. I am using the “lib_lightgbm.so” library file provided on Github. I am on ...
Ayush Goyal's user avatar
2 votes
1 answer
120 views

This is my directory structure before any build process: $ tree . . ├── go.mod ├── include │ └── calc.h ├── lib ├── main.go └── src ├── calc.c └── execute.c Then, I compiled C files and ...
kelsonic's user avatar
  • 117
0 votes
1 answer
234 views

I am using Tensorflow Lite API in C to infer results from a model file, for which code is written in a .c file across different functions. The functions include get_interpreter which creates a new ...
xihare's user avatar
  • 39
0 votes
1 answer
97 views

I have a c union that stores my data as part of a value struct union data_union { char *string_val; int8_t int8_val; int64_t int64_val; // so on }; typedef enum { MY_STRING, MY_INT8, ...
Abrar Ahmed's user avatar
3 votes
1 answer
680 views

I have a Golang project which uses some C libraries from another team in my company which come with shared objects and would be very difficult to compile statically. I would like to keep the binary ...
ILoveGit's user avatar
  • 362

1
2 3 4 5
19