cgo Questions
4
Solved
Starting from Go v1.6 cgo changed the rules of passing pointers to the C code golang/go#12416.
The example of invoking a dynamic Go callback from C code from the wiki doesn't work anymore.
package...
3
Requirement: An application has to be containerised as a docker image and needs to support arm64 and amd64 architectures.
Codebase: It is a golang application that needs to make use of git2go libra...
2
I'm trying to compile the following code on a MacOS machine
// #cgo darwin LDFLAGS: -L${SRCDIR}/build/darwin -lprocessing_lib
// #cgo linux LDFLAGS: -L${SRCDIR}/build/linux -lprocessing_lib
// #in...
2
Solved
Context: I was reading multiple articles about making my golang app FIPS compliant (in other words, making my app use boringcrypto instead of the native golang crypto):
https://kupczynski.info/pos...
3
I am trying to import and use cbrotli implementation from google as below:
import (
"fmt"
"io/ioutil"
cbrotli "github.com/google/brotli/go/cbrotli"
)
But I am getting the below error while t...
1
I ran into a problem where the Go program uses a .so lib, and the c code needs to deal with a signal SIGALRM. But it seems that once a signal SIGALRM is released, the program crashes.
From "Th...
4
Solved
I am trying to run go build on my sources.
go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: cannot find -lgdal
collect2: error: ld returned 1 exit status
My LD_LIBRA...
Satiety asked 11/6, 2019 at 16:19
2
Here is my code:
package main
import (
kusb "github.com/karalabe/usb"
tusb "github.com/trezor/trezord-go/usb"
)
func main() {
kusb.Enumerate(0, 0)
tusb.InitHIDAPI(nil)
}
When I compile (I'...
Rotman asked 11/6, 2019 at 6:41
6
Solved
I'm currently trying to add some C code to my Go project. nothing fancy
/*
#include <stdio.h>
void test() {
printf("hooola")
}
*/
import (
"C"
)
func MessageBox() {
C.test()
}
However...
4
Solved
I'm doing a test: compare excecution times of cgo and pure Go functions run 100 million times each. The cgo function takes longer time compared to the Golang function, and I am confused with this r...
Becker asked 2/2, 2015 at 6:35
1
Solved
I was trying to get a minimal example go app running inside a docker container.
But I kept getting exec /app: no such file or directory when running the container.
I checked and double checked all ...
Garboil asked 23/6, 2022 at 7:28
24
Solved
I am using Windows 10. When I tried to build Chaincode it reported this error
# github.com/hyperledger/fabric/vendor/github.com/miekg/pkcs11
exec: "gcc": executable file not found in %PATH%
My ...
Rennold asked 24/4, 2017 at 5:3
0
I don't know much about C/C++ but I have some knowledge about golang.
I was playing around with simple lib written in golang which I would like to use it in simple C++ program. I was thinking it wo...
Intellect asked 3/5, 2022 at 9:49
2
I am trying to execute cgo code under ubuntu 14.04, it seems like cgo assume CC/CXX to be gcc/g++. And I need to explicitly specify CC/CXX in order to use, say, clang. Can I configure default compi...
2
I have a shared library made with CGo and it links fine on Linux and Android. But when compiling on Windows 10 with Microsoft Visual Studio 2017, I get these errors:
Microsoft (R) Program Maintena...
Ensign asked 30/11, 2018 at 20:20
1
Solved
I am trying to cross compile https://github.com/joohoi/acme-dns for an aarch64 machine on my x86_64 desktop.
$ CC=aarch64-linux-gnu-gcc GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -v -ldflags=&q...
Gammon asked 11/9, 2021 at 16:9
2
Solved
I want to copy a Go string into a char * via CGO.
Am I allowed to do this something like this?
func copy_string(cstr *C.char) {
str := "foo"
C.GoString(cstr) = str
}
1
Solved
My Go app can work with MySQL, Postgres, and SQLite. At the first start, it asks what DB should be used.
SQLite works only with CGo. Depending on whether it is enabled or not, SQLite should be disp...
4
I'm trying to build a standard "Hello, World!" command-line executable for Android. The executable is to be run via adb shell.
0. The Go (Golang) Source
package main
import (
"fmt"
)
func main...
Elver asked 15/8, 2016 at 2:10
1
Solved
I want to code an app in go that is able to open a custom filetype (.slc) on MacOS. I created a blank xcode project to get all the necessary code and implemented it via cgo into my app. When I doub...
Pirnot asked 14/8, 2020 at 9:54
0
I have a Go program that uses the Qt wrapper library https://github.com/therecipe/qt. Unfortunately, the build time gets extremely high with it (assuming it's the go part)
go build -i . // takes ab...
Raskin asked 5/8, 2020 at 10:51
0
I wrote DLL to handle my VSCAN communication in golang. I'm facing a really hard problem now. Is there any way to signal state from cgo to c/cpp program?
I'm using a large CPP project, inside it ca...
2
Solved
I'm using a C library from Go using Cgo, and all is good except for callbacks. The library has a callback setter, which takes a pointer to the callback function. The callback function is written in...
1
Solved
I want to write controllers logic and handle json and databases in Golang, while having my math processing model in C. In my opinion overhead calling C function have to be as low, as as setting reg...
Leitman asked 17/3, 2020 at 19:43
1
Solved
I have a Go package—call it foo—I've built around some existing C code, and I'm trying to determine how best to distribute it.
A bit of background... Here's a simplified version of my ...
Nuclei asked 14/1, 2020 at 21:6
1 Next >
© 2022 - 2024 — McMap. All rights reserved.