1
0
mirror of https://github.com/chai2010/advanced-go-programming-book.git synced 2025-05-23 20:02:22 +00:00

Merge pull request #562 from InkDP/master

fix: 修改2.7.2无法运行代码
This commit is contained in:
chai2010 2021-12-20 00:57:53 +08:00 committed by GitHub
commit a224b71957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,11 +54,15 @@ cgo之所以存在的一大因素是为了方便在Go语言中接纳吸收过去
package main
/*
#include <stdlib.h>
#include <stdio.h>
void printString(const char* s) {
printf("%s", s);
}
*/
import "C"
import "unsafe"
func printString(s string) {
cs := C.CString(s)