I've used syscall.MustLoadDLL to load a DLL and MustFindProc to get 
*syscall.Procs to the functions I need. However, I can't find the info I 
need in the docs (if it is there a link would be great!)

If a DLL function returns an int >=0 in r1 do I need to cast this to a 
uintptr or can I just treat is as if it was a plain uint? (The latter seems 
to be working so far.)

To pass strings I'm doing this:

    pfilename, err := syscall.UTF16PtrFromString(filename)
    if err != nil {
        return nil, fmt.Errorf("failed to read filename %s: %s", filename, 
err)
    }
    r1, _, err := 
mydll.OpenFileReadOnly.Call(uintptr(unsafe.Pointer(pfilename)))

Is this correct?

What I don't know how to do is pass in a float64:

  w := 0.4
  r1, _, err := mydll.SetWidth(w) // wrong because not a uintptr

Thanks!

-- 
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