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

29
c/netdb/netdb.go Normal file
View File

@@ -0,0 +1,29 @@
package netdb
import (
"github.com/goplus/llgo/c/socket"
_ "unsafe"
"github.com/goplus/llgo/c"
)
const (
LLGoPackage = "decl"
)
type AddrInfo struct {
AiFlags c.Int
AiFamily c.Int
AiSockType c.Int
AiProtocol c.Int
AiAddrLen c.Uint
AiCanOnName *c.Char
AiAddr *socket.SockAddr
AiNext *AddrInfo
}
//go:linkname Getaddrinfo C.getaddrinfo
func Getaddrinfo(host *c.Char, port *c.Char, addrInfo *AddrInfo, result **AddrInfo) c.Int
//go:linkname Freeaddrinfo C.freeaddrinfo
func Freeaddrinfo(addrInfo *AddrInfo) c.Int