2019-04-26 22:44:30 -04:00
|
|
|
package main
|
2019-06-11 12:38:22 -04:00
|
|
|
|
2019-04-30 09:14:25 -04:00
|
|
|
//go:generate nswrap
|
2019-04-26 22:44:30 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2019-05-29 12:57:53 -04:00
|
|
|
ns "git.wow.st/gmp/nswrap/examples/simple/ClassOne"
|
2019-04-26 22:44:30 -04:00
|
|
|
)
|
|
|
|
|
2019-05-24 00:12:46 -04:00
|
|
|
func cb(super ns.ClassThreeSupermethods) ns.Int {
|
|
|
|
fmt.Printf("In Go callback\n")
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2019-04-26 22:44:30 -04:00
|
|
|
func main() {
|
2019-05-06 13:21:36 -04:00
|
|
|
o := ns.ClassOneAlloc().Init()
|
2019-06-11 12:38:22 -04:00
|
|
|
fmt.Println("i1 = ", o.Geti1())
|
|
|
|
fmt.Println("p1 = ", o.Getp1())
|
2019-04-26 22:44:30 -04:00
|
|
|
p1 := o.Getp1()
|
|
|
|
fmt.Println("*p1 = ", *p1)
|
|
|
|
*p1 = 17
|
|
|
|
fmt.Println("*p1 = ", *o.Getp1())
|
2019-04-30 09:14:25 -04:00
|
|
|
ns1 := o.Nstru1()
|
2019-04-26 22:44:30 -04:00
|
|
|
np := o.Nstru2()
|
2019-04-30 09:14:25 -04:00
|
|
|
fmt.Println(o.Hi1(ns1))
|
2019-04-26 22:44:30 -04:00
|
|
|
fmt.Println(o.Hi2(np))
|
2019-05-06 13:21:36 -04:00
|
|
|
o2 := ns.ClassTwoAlloc().Init()
|
2019-04-30 09:14:25 -04:00
|
|
|
fmt.Println(o2.Hi1(ns1))
|
2019-05-24 00:12:46 -04:00
|
|
|
o3 := ns.ClassThreeAlloc()
|
|
|
|
o3.Init()
|
|
|
|
o3.Geti1Callback(cb)
|
2019-05-21 16:26:52 -04:00
|
|
|
fmt.Println(o3.Hi2(np))
|
2019-05-24 00:12:46 -04:00
|
|
|
fmt.Println(o3.Geti1())
|
2019-04-26 22:44:30 -04:00
|
|
|
}
|