cl: initLinknameByDoc

This commit is contained in:
xushiwei
2024-05-01 21:18:28 +08:00
parent 8d3cb246c2
commit 52a64a7770
6 changed files with 79 additions and 20 deletions

View File

@@ -1,9 +1,16 @@
package main
import (
"github.com/goplus/llgo/internal/runtime/c"
)
import "unsafe"
//go:linkname cstr llgo.cstr
func cstr(string) *int8
//go:linkname stderr __stderrp
var stderr unsafe.Pointer
//go:linkname fprintf C.fprintf
func fprintf(fp unsafe.Pointer, format *int8, __llgo_va_list ...any)
func main() {
c.Fprintf(c.Stderr, c.Str("Hello %d\n"), 100)
fprintf(stderr, cstr("Hello %d\n"), 100)
}