示例文件src/test.gopackage mainimport ( . "clib")func main() { a := "123"; b := "456"; c := "789"; println(a,b,c); Output("ABC");}src/clib/clib.h#ifndef CLIBvoid output(char* str);#endifsrc/clib/clib.c#include "clib.h"#include <stdio.h>void output(char* str){ printf("%s\n", str);}src/clib/clib.gopackage clib/*#cgo CFLAGS:-g#include "clib.h"*/import "C"func Output(s string) { p := C.CString(s); C.output(p);}执行代码go build -gcflags "-N -l" test.gogdb ./testb 10rinfo locals // <- every variable's value is wrong!谁能帮我解决这个问题,非常感谢。我的环境:Ubuntu 11.04 i386gdb 7.6去 1.1
1 回答
- 1 回答
- 0 关注
- 255 浏览
添加回答
举报
0/150
提交
取消