On Wed, Apr 28, 2021 at 8:41 AM Aaron Epstein <sluggeraa...@gmail.com> wrote:
>
> I have a C library that I am linking with from Go whose name is known at 
> build-time, and is not a constant I can write in a comment like
> // #cgo LDFLAGS: -lmylib
>
> The library name is parameterized, i.e. libmy{VAR_NAME}lib.so
>
> Cgo doesn't seem to be able to handle environment variables, so I don't think 
> I can do
> // #cgo LDFLAGS: -lmy{VAR_NAME}lib
>
> And I don't have the option of setting the library name to be constant. Is 
> there a way I can link with cgo here?

Perhaps you can use "go build -ldflags=-extldflags=-lmylib".  I don't
know whether that will work for your case.

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/CAOyqgcU4m_toGLx_6QgFxs4171u_Wah9snNgWpx3WN01-hC3fg%40mail.gmail.com.

Reply via email to