How can I load .so
on Linux?
On Windows I do something like this:
h, e = syscall.LoadLibrary("name.dll")
if e != nil {
log.Fatal(e)
}
defer syscall.FreeLibrary(h)
Is it possible to do it on Linux with .so
library?
proc, e := syscall.GetProcAddress(h, processName) //One of the functions in the DLL
if e != nil {
log.Fatal("errror:", e, processName)
}
pid, _, _ := syscall.Syscall6(uintptr(proc), uintptr(paramSize), a1, a2, a3, 0, 0, 0) //handler, countParam, param, 0 // zawiera jakiegoś print "Hello World" - value
fmt.Println(processName, pid)
I want to get the function(process) address and use it to call in syscall.Syscall6.
There is answer with using CGo but it is not complete and doesn't explain how to void this function and pass param to it.