but i came to an error.
when i make, the error is
6g -p rand -o _go_.6 test_rand.go
test_rand.go:8: can't find import: "C"
make: *** [_go_.6] Error 1
this is my evn:
notedit@localhost:~/study/golang/gotest$ 6g -V
6g version weekly.2011-11-18 10582
notedit@localhost:~/study/golang/gotest$ cat test_rand.go
package rand
/*
#include <stdlib.h>
*/
import (
"C"
)
func Random() int {
return int(C.random())
}
func Seed(i int) {
C.srandom(C.uint(i))
}
notedit@localhost:~/study/golang/gotest$ cat Makefile
include $(GOROOT)/src/Make.inc
TARG=rand
GOFILES=\
test_rand.go\
include $(GOROOT)/src/Make.pkg
CGOFILES=\
test_rand.go\
notedit <note...@gmail.com> wrote:
> today i try the cgo on my mba, i try the rand.go example onhttp://blog.golang.org/2011/03/c-go-cgo.html