From 0b5fc9774f6cf155ba4ff1a8e4e3e753206ad969 Mon Sep 17 00:00:00 2001 From: stephana Date: Fri, 31 Oct 2014 07:11:19 -0700 Subject: [PATCH] Quick and dirty test to call the C interface from GO. BUG=skia: Review URL: https://codereview.chromium.org/670303005 --- experimental/go-skia/skia.go | 30 ++++++++++++++++++++++++++++++ include/c/sk_surface.h | 4 ++++ 2 files changed, 34 insertions(+) create mode 100644 experimental/go-skia/skia.go diff --git a/experimental/go-skia/skia.go b/experimental/go-skia/skia.go new file mode 100644 index 0000000000..0758c432d1 --- /dev/null +++ b/experimental/go-skia/skia.go @@ -0,0 +1,30 @@ +package skia + +/* +#cgo CFLAGS: -I../../include/c +#cgo LDFLAGS: -L ../../out/Debug/ +#cgo LDFLAGS: -lskia_core +#cgo LDFLAGS: -lskia_effects +#cgo LDFLAGS: -lskia_images +#cgo LDFLAGS: -lskia_opts +#cgo LDFLAGS: -lskia_ports +#cgo LDFLAGS: -lskia_sfnt +#cgo LDFLAGS: -lskia_utils +#cgo LDFLAGS: -lskia_opts_ssse3 +#cgo LDFLAGS: -lskia_opts_sse4 +#cgo LDFLAGS: -lm +#cgo LDFLAGS: -lstdc++ +#cgo LDFLAGS: -lGL +#cgo LDFLAGS: -lGLU +#include "sk_surface.h" +*/ +import "C" + +func dummyFunction() { + testPaint := C.sk_paint_new() + defer func() { + sk_paint_delete(testPaint) + }() +} + +// TODO: replace this with an idiomatic interface to Skia. diff --git a/include/c/sk_surface.h b/include/c/sk_surface.h index 960c331d2d..5fcf9ddd41 100644 --- a/include/c/sk_surface.h +++ b/include/c/sk_surface.h @@ -14,6 +14,10 @@ #include #include +#ifndef __cplusplus +#include +#endif + #ifdef __cplusplus extern "C" { #endif