Home / Go / cgo edit

Links:

==> ./configure --prefix=/usr/local/Cellar/jpeg-turbo/1.3.1 --with-jpeg8 --mandir=/usr/local/Cellar/jpeg-turbo/1.3.1/share/man NASM=/usr/local/Cellar/nasm/2.11.05/bin/nasm
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

libjpeg-turbo is not linked to prevent conflicts with the standard libjpeg.

    LDFLAGS:  -L/usr/local/opt/jpeg-turbo/lib
    CPPFLAGS: -I/usr/local/opt/jpeg-turbo/include
    

image magick serializes libjpeg calls:
http://www.imagemagick.org/discourse-server/viewtopic.php?f=2&t=25495

https://gowalker.org/github.com/jeremytorres/jpegextract#performance - this says that libjpeg-turbo is 8x faster than Go, libjpeg 3x faster

http://dennisforbes.ca/index.php/2013/07/31/demonstrating-gos-easy-c-interop/

Cgo with pkg-config:
/*
#cgo pkg-config: vips
#include "vips.h"
*/

Cgo with explicit flags:
// #cgo LDFLAGS: -L/usr/local/Cellar/jpeg-turbo/1.3.1/lib -ljpeg
// #cgo CFLAGS: -I/usr/local/Cellar/jpeg-turbo/1.3.1/include

Cgo with different flags for different OSes:

// #cgo linux LDFLAGS: -L/opt/irlibs/lib -ljpeg
// #cgo linux CFLAGS: -I/opt/irlibs/include
// #cgo darwin LDFLAGS: -L/usr/local/Cellar/jpeg-turbo/1.3.1/lib -ljpeg
// #cgo darwin CFLAGS: -I/usr/local/Cellar/jpeg-turbo/1.3.1/include
Go to index of articles.

Share on