inline static cgo workaround, callback function name changes

pull/13/head^2
Joseph Poirier 2015-08-19 01:32:11 -05:00
rodzic dd52591b1f
commit bb39c687c5
2 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -16,9 +16,9 @@ package dump978
#include <stdint.h>
#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.

Wyświetl plik

@ -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