On Thu, Jun 23, 2016 at 6:16 PM,  <an...@webkr.de> wrote:
> On https://github.com/golang/go/wiki/WindowsDLLs it says:
>
>> First way: Dynamically load a dll, then call a method on it. You can call
>> the method via "syscallXX" (the XX is number of parameters, but if it has
>> few than that, like if you need seven parameter, then syscall9 will still
>> work, you just tell it the number of arguments is 7). *This way also works
>> with Linux shared libraries, as well, if you're targeting linux.*
>
> The page then proceeds to show code that essentially does:
>
> kernel32, _        = syscall.LoadLibrary("kernel32.dll")
> getModuleHandle, _ = syscall.GetProcAddress(kernel32, "GetModuleHandleW")
> syscall.Syscall(uintptr(getModuleHandle), nargs, 0, 0, 0)
>
> But when I try this on linux I get:
>
> ./main.go:9: undefined: syscall.LoadLibrary
>
> So, how exactly does this method work with Linux shared libraries?

Well, it doesn't.  I'm really not sure what that sentence was intended
to mean.  I just remove it from the wiki page.

On GNU/Linux you can use the cgo method mentioned at the very bottom
of the page.  No other mechanism is available at present.

Ian

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to