sbinet / go-python

naive go bindings to the CPython2 C-API
Other
1.52k stars 138 forks source link

what does the cgoflags.go do? #74

Closed panchengtao closed 5 years ago

panchengtao commented 5 years ago

Recently, I wrote a go program to call python 3.X code.I hava to declare the flowing code

//#cgo CFLAGS : -I./ -I/usr/include/python3.6
//#cgo LDFLAGS: -L/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu -L/usr/lib -lpython3.6m -lpthread -ldl  -lutil -lm
//#include "Python.h"
import "C"

And when I review your code, I do not know how you link to python.h and I can not find more answer when google.I think cgoflags.go is the keypoint, can you help me?

sbinet commented 5 years ago

cgo may be instructed to use pkg-config to discover all the -I, -l and -L compilation flags. see:

hth

panchengtao commented 5 years ago

thx!