On Sun, Aug 9, 2020 at 9:57 AM Miki Tebeka <miki.teb...@gmail.com> wrote:
>
> Is there a way to pass include path dynamically to cgo?
>
> I'm working with numpy and the way to find the include directory is to call 
> (in Python)
> numpy.get_include()
>
> In a Makefile I can run go build with
> CGO_CFLAGS=-I $(shell python -c 'import numpy; print(numpy.get_include())') 
> go build
>
> but I don't know how to do it as a
> #cgo CFLAGS:
> directive and I'd like to have the module go gettable

The usual approach is to use "#cgo pkg-config:".  But that assumes
that numpy provides pkg-config definitions.  There isn't any other
support for dynamic dependencies specified in the Go input file.  In
particular we don't and won't permit running arbitrary programs in a
#cgo line.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcUCCURrGcaNgKANchm7drAHo4ChXx00L%3DkO%3DUuSuM%3DH1Q%40mail.gmail.com.

Reply via email to