PageRenderTime 44ms CodeModel.GetById 34ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

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

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