mirror of
https://github.com/yanfeizhang/coder-kung-fu.git
synced 2026-05-05 11:44:13 +08:00
up
This commit is contained in:
@@ -2,4 +2,5 @@
|
||||
- [物理机 cpu 系统利用率的计算过程](tests/cpu/test06)
|
||||
- [容器 cpu 系统利用率的计算过程](tests/cpu/test07)
|
||||
- [直接使用perf_event_open获取硬件计数](tests/cpu/test08)
|
||||
- [火焰图专用测试代码](tests/cpu/test09)
|
||||
- [火焰图专用测试代码](tests/cpu/test09)
|
||||
- [C语言调用Golang函数原理](tests/cpu/test10)
|
||||
9
tests/cpu/test10/main.c
Normal file
9
tests/cpu/test10/main.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include "libadd.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int ret = add(2,3);
|
||||
printf("C调用Go函数2+3=%d", ret);
|
||||
return 0;
|
||||
}
|
||||
12
tests/cpu/test10/main.go
Normal file
12
tests/cpu/test10/main.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package main
|
||||
|
||||
//int add(int a, int b);
|
||||
import "C"
|
||||
|
||||
//export add
|
||||
func add(a, b C.int) C.int {
|
||||
return a + b
|
||||
}
|
||||
|
||||
func main() {
|
||||
}
|
||||
Reference in New Issue
Block a user