It sounds to me like you are trying to write linux code to load a .so file. 
Not something I have done in a while, but since no one else has offered any 
help, I will give you a few pointers. 

I believe that syscall.LoadDLL  is for Windows only, so that code *will not 
work* at all in linux. 
You will probably need to use CGO (https://pkg.go.dev/cmd/cgo). Sadly CGO 
is difficult, especially for newbies. It is also tricky, so make sure to 
follow the rules laid out. 

Other than that,  I would suggest using a google search like, 
https://www.google.com/search?q=golang+use+so+file and expect a steep 
learning curve.

Good Luck!
On Thursday, January 19, 2023 at 1:04:49 PM UTC-5 Nadia shokkan wrote:

> Hi there,
>
> I'm Nadia from Malaysia. also newbie in Go language. I have a project that 
> already works in windows(my manager do that code), and my manager ask me 
> todo same thing in linux..the project need to use function from .so library 
> given. the problem is i dont know how to do it. btw sorry im still fresh 
> grade. 
>
> I did google and found dl.Open and dlopen. The dl.Open are work, but i 
> dont know how to use the function in the library. dlopen doesnt work in my 
> code..
>
> here is my code
> //original from windows
> dll, err := syscall.LoadDLL("csxapi.dll")
> lib, err := dl.Open("pkg/libcsxapi.so", dl.RTLD_NOW)
> if err != nil {
> log.Fatalf("Instance: failed to load csxapi.dll: %v", err)
> }
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/055705f6-dbe3-4334-aec0-b76e45b56798n%40googlegroups.com.

Reply via email to