feat(llgo/c):Add an INI parser (#466)

* feat(llgo/c):Add an INI parser
This commit is contained in:
morpingsss
2024-07-08 18:28:18 +08:00
committed by GitHub
parent 5d7840a34c
commit 62ffa14f10
3 changed files with 72 additions and 0 deletions

24
c/inih/inih.go Normal file
View File

@@ -0,0 +1,24 @@
package inih
/*
#include <stdio.h>
#include <stdlib.h>
*/
import (
_ "unsafe"
"github.com/goplus/llgo/c"
)
const (
LLGoPackage = "link: $(pkg-config --libs inih); -linih"
)
//go:linkname Parse C.ini_parse
func Parse(filename *c.Char, handler func(user c.Pointer, section *c.Char, name *c.Char, value *c.Char) c.Int, user c.Pointer) c.Int
//go:linkname ParseFile C.ini_parse_file
func ParseFile(file c.FilePtr, handler func(user c.Pointer, section *c.Char, name *c.Char, value *c.Char) c.Int, user c.Pointer) c.Int
//go:linkname ParseString C.ini_parse_string
func ParseString(str *c.Char, handler func(user c.Pointer, section *c.Char, name *c.Char, value *c.Char) c.Int, user c.Pointer) c.Int