github.com/goplus/llgo@v0.8.3/cl/_testrt/struct/in.go (about)

     1  package main
     2  
     3  import "C"
     4  import _ "unsafe"
     5  
     6  //go:linkname printf C.printf
     7  func printf(format *int8, __llgo_va_list ...any)
     8  
     9  type Foo struct {
    10  	A  C.int
    11  	ok bool
    12  }
    13  
    14  var format = [...]int8{'H', 'e', 'l', 'l', 'o', ' ', '%', 'd', '\n', 0}
    15  
    16  func (p Foo) Print() {
    17  	if p.ok {
    18  		printf(&format[0], p.A)
    19  	}
    20  }
    21  
    22  func main() {
    23  	foo := Foo{100, true}
    24  	foo.Print()
    25  }