go调用c函数出错

yh_123 · · 2452 次点击
>The message is confusing, until you realize that the ... is the variadic portion of a C function. You can't use C variadic >functions directly from Go, so you'll have to write a small wrapper in C to call http://stackoverflow.com/questions/26852407/unexpected-type-with-cgo-in-go package main /* #include <stdio.h> void myprintf(char *s) { printf("%s\n", s); } */ import "C" func main() { path := C.CString("/home/yanhao/1.txt") C.myprintf(path) }
#1