main.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //go:build darwin || freebsd || linux || windows
  2. package yu_sys
  3. type Code byte
  4. const (
  5. Gbk Code = iota
  6. Unicode
  7. )
  8. type S struct {
  9. // Code
  10. //
  11. // @Description: 要将字符串转换为哪种编码,转换后会自动在尾部补充 \x00 结束符
  12. // utf8 请直接传递 string,无需此高级类型,utf8 请自行决定是否在尾部补充 \x00 结束符
  13. Code Code
  14. // Utf8
  15. //
  16. // @Description: 欲转换的 utf8 字符串
  17. Utf8 string
  18. }
  19. type Address uintptr
  20. func (t Address) CallInt(args ...any) int {
  21. j_i, _, _ := t.Call(args...)
  22. return int(j_i)
  23. }
  24. func (t Address) CallInt32(args ...any) int32 {
  25. j_i, _, _ := t.Call(args...)
  26. return int32(j_i)
  27. }
  28. func (t Address) CallUint(args ...any) uint {
  29. j_i, _, _ := t.Call(args...)
  30. return uint(j_i)
  31. }
  32. func (t Address) CallUint32(args ...any) uint32 {
  33. j_i, _, _ := t.Call(args...)
  34. return uint32(j_i)
  35. }
  36. func (t Address) CallBool(args ...any) bool {
  37. j_i, _, _ := t.Call(args...)
  38. return j_i == 1
  39. }
  40. func (t Address) CallUintptr(args ...any) uintptr {
  41. j_i, _, _ := t.Call(args...)
  42. return j_i
  43. }
  44. type Module uintptr