From bb39c687c5fc541738b2cd3a2964bf2aae5399e5 Mon Sep 17 00:00:00 2001 From: Joseph Poirier Date: Wed, 19 Aug 2015 01:32:11 -0500 Subject: [PATCH] inline static cgo workaround, callback function name changes --- dump978.go | 8 ++++---- exports.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dump978.go b/dump978.go index c2a52c50..6e78c1b8 100644 --- a/dump978.go +++ b/dump978.go @@ -16,9 +16,9 @@ package dump978 #include #include "dump978/dump978.h" -extern void goCallback(char updown, uint8_t *data, int len); -CallBack get_go_cb() { - return (CallBack)goCallback; +extern void dump978Cb(char updown, uint8_t *data, int len); +static inline CallBack GetGoCb() { + return (CallBack)dump978Cb; } */ import "C" @@ -31,7 +31,7 @@ type UserCbT func(C.char, *C.uint8_t, C.int) // Dump978Init must be the first function called in this package. func Dump978Init() { - C.Dump978Init((C.CallBack)(C.get_go_cb())) + C.Dump978Init((C.CallBack)(C.GetGoCb())) } // ProcessData passes buf (modulated data) to dump978 for demodulation. diff --git a/exports.go b/exports.go index 24fb92f9..66ddabb1 100644 --- a/exports.go +++ b/exports.go @@ -20,8 +20,8 @@ import "C" // outChan is a buffered output channel for demodulated data. var OutChan = make(chan []byte, 100) -//export goCallback -func goCallback(updown C.char, data *C.uint8_t, length C.int) { +//export dump978Cb +func dump978Cb(updown C.char, data *C.uint8_t, length C.int) { outData := make([]byte, length+1) // c buffer to go slice without copying var buf []byte