1
0

sdk.go 522 B

123456789101112131415161718192021222324252627282930313233
  1. package main
  2. import "C"
  3. import (
  4. "fmt"
  5. "github.com/cnlh/nps/client"
  6. "time"
  7. )
  8. //export PrintBye
  9. func PrintBye() {
  10. fmt.Println("From DLL: Bye!")
  11. }
  12. var status bool
  13. //export Sum
  14. func StartClientByVerifyKey(a int, b int) bool {
  15. c := client.NewRPClient(*serverAddr, *verifyKey, *connType, *proxyUrl, nil)
  16. go func() {
  17. for {
  18. status = true
  19. c.Start()
  20. status = false
  21. time.Sleep(time.Second * 5)
  22. }
  23. }()
  24. return true
  25. }
  26. func main() {
  27. // Need a main function to make CGO compile package as C shared library
  28. }