New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ch2.7.2 C临时访问传入的Go内存 P111的示例没有打印输出 #511
Comments
修改为如下代码就可以正常输出了, 难道是线程退出时没有刷新缓冲区?????? /*
void printString(const char* s) {
printf("%s", s);
printf("\n");
}
*/
import "C"
func printString(s string) {
cs := C.CString(s)
defer C.free(unsafe.Pointer(cs))
C.printString(cs)
}
func main() {
s := "hello"
printString(s)
} |
可以手工调用 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ch2.7.2 C临时访问传入的Go内存 P111的示例没有打印输出
The text was updated successfully, but these errors were encountered: