PageRenderTime 86ms CodeModel.GetById 24ms RepoModel.GetById 8ms app.codeStats 0ms

/trunk/Examples/go/funcptr/runme.go

#
Go | 25 lines | 19 code | 5 blank | 1 comment | 0 complexity | 7486922c30a179435f535543d6b56c5b MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. package main
  2. import (
  3. "fmt"
  4. . "./example"
  5. )
  6. func main() {
  7. a := 37
  8. b := 42
  9. // Now call our C function with a bunch of callbacks
  10. fmt.Println("Trying some C callback functions")
  11. fmt.Println(" a = ", a)
  12. fmt.Println(" b = ", b)
  13. fmt.Println(" ADD(a,b) = ", Do_op(a, b, ADD))
  14. fmt.Println(" SUB(a,b) = ", Do_op(a, b, SUB))
  15. fmt.Println(" MUL(a,b) = ", Do_op(a, b, MUL))
  16. fmt.Println("Here is what the C callback function classes are called in Go")
  17. fmt.Println(" ADD = ", ADD)
  18. fmt.Println(" SUB = ", SUB)
  19. fmt.Println(" MUL = ", MUL)
  20. }