Files
llgo/compiler/cl/_testrt/linkname/in.go

30 lines
658 B
Go
Raw Normal View History

2024-05-02 23:14:12 +08:00
package main
import (
_ "unsafe"
"github.com/goplus/llgo/c"
2025-01-07 21:49:08 +08:00
_ "github.com/goplus/llgo/compiler/cl/internal/linktarget"
2024-05-02 23:14:12 +08:00
)
2025-01-07 21:49:08 +08:00
//go:linkname print github.com/goplus/llgo/compiler/cl/internal/linktarget.F
2024-05-02 23:14:12 +08:00
func print(a, b, c, d *c.Char)
2024-05-29 09:36:53 +08:00
type m struct {
s string
}
2025-01-07 21:49:08 +08:00
//go:linkname setInfo github.com/goplus/llgo/compiler/cl/internal/linktarget.(*m).setInfo
2024-05-29 09:36:53 +08:00
func setInfo(*m, string)
2025-01-07 21:49:08 +08:00
//go:linkname info github.com/goplus/llgo/compiler/cl/internal/linktarget.m.info
2024-05-29 09:36:53 +08:00
func info(m) string
2024-05-02 23:14:12 +08:00
func main() {
print(c.Str("a"), c.Str("b"), c.Str("c"), c.Str("d"))
print(c.Str("1"), c.Str("2"), c.Str("3"), c.Str("4"))
2024-05-29 09:36:53 +08:00
var m m
setInfo(&m, "hello")
println(info(m))
2024-05-02 23:14:12 +08:00
}