So I am try to get a simple CGO program going with a GO function that can
get called back from a 'C' library
the error I get is
In file included from _cgo_export.c:3:
cgo-gcc-export-header-prolog:42:14: error: conflicting types for
'_go_Callback'
src/smsdk/go_bindings.go:12:12: note: previous declaration is here
_cgo_export.c:17:7: error: conflicting types for '_go_Callback'
src/smsdk/go_bindings.go:12:12: note: previous declaration is here
The code is simple looks like this
package smsdk
/*
#cgo CFLAGS: -Damd64 -D SM_SDK_INTERNAL -I ${SRCDIR}/smsdk
#cgo LDFLAGS: -L${SRCDIR} -lsm_sdk
#include <stdbool.h>
#include <stdlib.h>
#include "sm_sdk.h"
extern int _go_Callback(int speaking_state);
static void Callback(Handle h, void * caller_context)
{
int val = CLibraryFunction(h);
_go_Callback(val);
}
*/
import "C"
import (
"unsafe"
"sync"
)
var _registeredCallback func(int)
//export _go_SpeakingStateCallback
func _go_SpeakingStateCallback(val int) int {
if _registeredCallback != nil {
_registeredCallback(val)
return 1
}
return 0
}
Any suggestions?
--
"This communication is confidential and may contain privileged
and/or copyright material. If you are not the intended recipient you must
not use, disclose, copy or retain it. If you have received it in error
please immediately notify me by return email, delete the emails and destroy
any hard copies. Soul Machines Limited does not guarantee the integrity of
this communication, or that it is free from errors, viruses or
interference."
*Please consider the environment before printing this
email.*
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.