2024-04-23 22:10:40 -06:00
|
|
|
package ncurses
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ebitengine/purego"
|
|
|
|
)
|
|
|
|
|
|
|
|
var libc uintptr = 0
|
|
|
|
func libcFunction[T any](name string) T {
|
|
|
|
if libc == 0 {
|
|
|
|
var err error
|
|
|
|
libc, err = purego.Dlopen(LIBC_PATH, purego.RTLD_GLOBAL | purego.RTLD_NOW)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var tmp = new(T)
|
|
|
|
purego.RegisterLibFunc(tmp, libc, name)
|
|
|
|
return *tmp
|
|
|
|
}
|
|
|
|
|
2024-04-24 01:18:32 -06:00
|
|
|
type setlocaleFP func(category int, locale string) string
|
2024-04-23 22:10:40 -06:00
|
|
|
var SetLocale = libcFunction[setlocaleFP]("setlocale")
|