You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our requirement is to call a function in Golang library in C++ code. Currently we are building the library using -buildmode=c-shared.
The function in golang library is using a struct as input and output. For example like:
type Request struct {
X string
Y string
Z map[string]string
}
We don't use the issue tracker for questions. You will get better and faster answers using a forum. See https://golang.org/wiki/Questions. Thanks.
There is basically no way to create a Go string in C++, and there is definitely no way to create Go map value in C++, so there isn't going to be any reasonable way for you to call a Go function with that struct from C++.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Our requirement is to call a function in Golang library in C++ code. Currently we are building the library using
-buildmode=c-shared
.The function in golang library is using a struct as input and output. For example like:
If I try using C struture then it doesn't support string and map which makes it complex.
https://play.golang.org/p/Qjuu5j2nAv1
What did you expect to see?
We can call a golang function using struct with fields string and map from C++?
Is there any easier approach to solve this problem?
What did you see instead?
_cgo_export.c:124:22: error: incomplete result type 'struct SpeechRequest' in function definition
sample.go.txt
The text was updated successfully, but these errors were encountered: