简介:搭建完成wsl后,可以运行原生Linux二进制可执行文件。
案例1:执行go可执行文件。
go源码:main.go
package main
import (
"fmt"
"time"
)
func say(s string) {
for i := 0; i < 3; i++ {
time.Sleep(100 * time.Millisecond)
fmt.Println(s)
}
}
func main() {
go say("world")
say("hello")
}
编译,执行:
go bulid main.go
./main
案例2:执行C可执行文件。
C源码:hello.c
#include <unistd.h>
#include <stdio.h>
int main()
{
printf("Hello World !\n");
}
编译,执行:
gcc -o hello.out hello.c
./hello.out
微信公众号:玩转测试开发
欢迎关注,共同进步,谢谢!