github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/cgo/testdata/const.out.go (about)

     1  package main
     2  
     3  import "unsafe"
     4  
     5  var _ unsafe.Pointer
     6  
     7  //go:linkname C.CString runtime.cgo_CString
     8  func C.CString(string) *C.char
     9  
    10  //go:linkname C.GoString runtime.cgo_GoString
    11  func C.GoString(*C.char) string
    12  
    13  //go:linkname C.__GoStringN runtime.cgo_GoStringN
    14  func C.__GoStringN(*C.char, uintptr) string
    15  
    16  func C.GoStringN(cstr *C.char, length C.int) string {
    17  	return C.__GoStringN(cstr, uintptr(length))
    18  }
    19  
    20  //go:linkname C.__GoBytes runtime.cgo_GoBytes
    21  func C.__GoBytes(unsafe.Pointer, uintptr) []byte
    22  
    23  func C.GoBytes(ptr unsafe.Pointer, length C.int) []byte {
    24  	return C.__GoBytes(ptr, uintptr(length))
    25  }
    26  
    27  type (
    28  	C.char      uint8
    29  	C.schar     int8
    30  	C.uchar     uint8
    31  	C.short     int16
    32  	C.ushort    uint16
    33  	C.int       int32
    34  	C.uint      uint32
    35  	C.long      int32
    36  	C.ulong     uint32
    37  	C.longlong  int64
    38  	C.ulonglong uint64
    39  )
    40  
    41  const C.foo = 3
    42  const C.bar = C.foo