23 lines
451 B
Go
23 lines
451 B
Go
package main
|
|
|
|
/*
|
|
#cgo LDFLAGS: -lsilly
|
|
#include <silly.h>
|
|
*/
|
|
import "C"
|
|
|
|
import "fmt"
|
|
|
|
/**
|
|
* Use LD_LIBRARY_PATH=. to inject the shared object.
|
|
*/
|
|
func main() {
|
|
silly_one := C.struct_Silly{age: 12, legs: 21}
|
|
silly_two := C.struct_Silly{age: 2, legs: 4}
|
|
C.print(&silly_one)
|
|
C.print(&silly_two)
|
|
C.add(&silly_one, &silly_two)
|
|
C.print(&silly_one)
|
|
C.print(&silly_two)
|
|
fmt.Println("Silly version %d, author: %s", C.SILLY_VERSION, C.SILLY_AUTHOR)
|
|
}
|