llgo/c/hyper-related c lib

This commit is contained in:
赵英杰
2024-07-16 11:49:38 +08:00
parent 1cf57508b0
commit 519c850f17
9 changed files with 255 additions and 0 deletions

21
_demo/netdb/netdb.go Normal file
View File

@@ -0,0 +1,21 @@
package main
import (
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/netdb"
"github.com/goplus/llgo/c/socket"
)
func main() {
var hints netdb.AddrInfo
hints.AiFamily = socket.AF_UNSPEC
hints.AiSockType = socket.SOCK_STREAM
host := "httpbin.org"
port := "80"
var result *netdb.AddrInfo
c.Printf(c.Str("%d\n"), netdb.Getaddrinfo(c.Str(host), c.Str(port), &hints, &result))
c.Printf(c.Str("%d\n"), netdb.Freeaddrinfo(result))
}