github.com/jxskiss/gopkg@v0.17.3/internal/linkname/utils.go (about) 1 package linkname 2 3 import ( 4 "reflect" 5 "unsafe" 6 ) 7 8 // iface is a copy type of runtime.iface. 9 type iface struct { 10 tab unsafe.Pointer // *itab 11 data unsafe.Pointer 12 } 13 14 // toRType converts a reflect.Type value to *rtype. 15 func toRType(t reflect.Type) unsafe.Pointer { 16 return (*iface)(unsafe.Pointer(&t)).data 17 }