sbinet / go-python

naive go bindings to the CPython2 C-API
Other
1.53k stars 139 forks source link

what does the cgoflags.go do? #74

Closed panchengtao closed 6 years ago

panchengtao commented 6 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 6 years ago

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

hth

panchengtao commented 6 years ago

thx!