mv _testcgo => _testrt

This commit is contained in:
xushiwei
2024-04-30 23:18:18 +08:00
parent f7a54e3377
commit d3fddfb634
24 changed files with 9 additions and 5 deletions

25
cl/_testrt/struct/in.go Normal file
View File

@@ -0,0 +1,25 @@
package main
import "C"
import _ "unsafe"
//go:linkname printf C.printf
func printf(format *int8, __llgo_va_list ...any)
type Foo struct {
A C.int
ok bool
}
var format = [...]int8{'H', 'e', 'l', 'l', 'o', ' ', '%', 'd', '\n', 0}
func (p Foo) Print() {
if p.ok {
printf(&format[0], p.A)
}
}
func main() {
foo := Foo{100, true}
foo.Print()
}