Hi Serguei,

a Go string or *string do not correspond to a C char *
You must pass the address of the first byte of a sufficiently large buffer:

func GetGroupFD(group int, pciDevice *string) (int, error) {
  const N = 256
  var buffer [N]byte
  device, _, errno := syscall.Syscall(
        syscall.SYS_IOCTL,
        uintptr(group),
        uintptr(unsafe.Pointer(&ioctlId)),
        &buffer[0],
    )
   /* if ioctl() is successful, find '\0' in buffer[] and copy the relevant 
portion in *pciDevice */
}

On Thursday, August 23, 2018 at 2:55:29 PM UTC+2, sbez...@cisco.com wrote:
>
> I changed code a little bit to be able to examine variables:
>
>  
>
>  func GetGroupFD(group int, pciDevice *string) (int, error) {
>
>     ioctlId := 0x3b6a 
>
>     var buffer uintptr
>
>     buffer = uintptr(unsafe.Pointer(pciDevice))
>
>

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