Created
February 17, 2014 05:18
-
-
Save copyninja/9045137 to your computer and use it in GitHub Desktop.
Sample go program for cgo testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
/* | |
#include "pointer.h" | |
*/ | |
import "C" | |
import "fmt" | |
type SStruct struct { | |
s *C.SampleStruct | |
} | |
func main(){ | |
var ss SStruct | |
fmt.Printf("Trying to read a structure by passing pointer\n") | |
C.GetSampleStruct(ss.s); | |
fmt.Printf("SampleStruct read!:\n") | |
fmt.Printf("a: %d b: %d c: %f",ss.s.a, ss.s.b, ss.s.c) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment