On Wednesday, April 3, 2019 at 5:30:27 PM UTC+2, T L wrote:
>
> Assume I have a .go soruce file like:
>
> /*
> #cgo LDFLAGS: -L${SRCDIR}/lib/static/linux/amd64 -lmylib
> ... // more flags
> */
> import "C"
>
> ... // many cross-platform Go code lines
>
>
> Now, It compiles ok on Linux AMD64 platform.
>
> There are several library files under different subfolders of
> "${SRCDIR}/lib/static".
> For example, the Linux-amd64 version is put in the "/linux/amd64"
> subfolers.
> How to let the cgo directives to adaptively select the corresponding
> static library file on different platforms?
>
Ideally you can use the pkg-config directive.
However it is (AFAIK) not supported by all platforms, and some OS
distributions may not include the pkg-config config file for some libraries.
As an example, Archlinux does not have a .pc file for libmagic.
Manlio
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.