Call c-static-lib in Go
How to compile and call a C-static lib in Golang
touch some files first
1 | # create a directory for this project |
Create a header file: hi.h
1 |
|
Create a source file: hi.c
1 |
|
Create a main file: main.go
1 | package main |
Compile the source file into a static library
1 | gcc -c ./lib/hi.c -o ./lib/hi.o |
Run
1 | # go run directly |