golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
120.09k stars 17.24k forks source link

x/mobile: Is it possible to send a function as argument from Java to golang? #67136

Closed sourish115 closed 2 weeks ago

sourish115 commented 2 weeks ago

I am using gomobile bind to generate binding for android. I have a use case where I want to write and export a function in golang which takes in a simple function as an argument like so: func SetCallback(cb Callback) where Callback is a user defined type: type Callback func(string) However gomobile bind is not able to generate java bindings for this function. I have tried to do this directly without defining a Callback type, but no success. Is there any other way to do this? Thank you for your time, looking forward to your response.

seankhliao commented 2 weeks ago

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions