I am a python developer making the shift to Golang, so I'm sorry for the noob question. I am responsible for taking some Haskell code, for which we have python bindings, and making it callable from Go. I have a shared object file, _foo.so
, that I want to somehow import into Go and call a la:
import (
f "_foo.so"
)
func DoBar() {
return f.Bar()
}
Is this possible? I don't even have the first idea of where to begin, but I'm hoping that pseudo code gets the idea across.
As already mentioned in the comments, you need to go through C.
Good news: the python binding you have goes through C already. It means that haskell code exposes all the necessary API as C functions, you just need to find out how the API looks like and call it using cgo
. You probably don't need to know anything about haskell.
Assuming you have access to the source code, you should look for *.c
and *.h
files (often located in a cbits
folder). If you don't know C, then ask your teammates to help.
If you don't have access to the code, then you may try to guess the C API using the python binding. Though it'll be quite hard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With