From c0f94630a0f0e3a1a795fd5a12e90dff22b542cf Mon Sep 17 00:00:00 2001 From: Milan Nikolic Date: Fri, 23 Oct 2015 09:08:17 +0200 Subject: [PATCH 1/2] This fixes #12 , cgo doesn't turn undefined structs into *[0]byte anymore, as explained here https://github.com/golang/go/issues/7958#issuecomment-66094578 --- surface.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/surface.go b/surface.go index 0a410e0..1de5067 100644 --- a/surface.go +++ b/surface.go @@ -16,10 +16,13 @@ import ( "github.com/ungerik/go-cairo/extimage" ) +type Cairo_surface *C.cairo_surface_t +type Cairo_context *C.cairo_t + // Golang struct to hold both a cairo surface and a cairo context type Surface struct { - surface *C.cairo_surface_t - context *C.cairo_t + surface Cairo_surface + context Cairo_context } func NewSurface(format Format, width, height int) *Surface { @@ -30,7 +33,7 @@ func NewSurface(format Format, width, height int) *Surface { // NewSurfaceFromC creates a new surface from C data types. // This is useful, if you already obtained a surface by // using a C library, for example an XCB surface. -func NewSurfaceFromC(s *C.cairo_surface_t, c *C.cairo_t) *Surface { +func NewSurfaceFromC(s Cairo_surface, c Cairo_context) *Surface { return &Surface{surface: s, context: c} } From 9e93b9bf1d79583d4a97f8873f7e7da6f9c3b57d Mon Sep 17 00:00:00 2001 From: Milan Nikolic Date: Fri, 23 Oct 2015 09:13:31 +0200 Subject: [PATCH 2/2] use string.h instead of strings.h to silence warning: implicit declaration of function 'memcpy' --- png.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/png.go b/png.go index a697430..727fc86 100644 --- a/png.go +++ b/png.go @@ -4,7 +4,7 @@ package cairo // #cgo pkg-config: cairo // #include // #include -// #include +// #include // #include // // #define GO_CAIRO_VECTOR_INIT_SIZE 64