Hi gophers,
I'm trying to write the Golang wrapper for a dll with CGO.
A wrapper that will only work in windows.
I need to be able to send UTF-8 or unicode strings to c.
This issue was never asked on platforms like stackoverflow.
So I couldn't find a solution.
https://github.com/dkager/tolk/blob/master/src/Tolk.h#l72
line 72
https://github.com/dkager/tolk/blob/master/src/Tolk.h#l100
line 100
I am adding the code I tried below:
package talker
//#cgo windows CFLAGS: -DGO_WINDOWS -Iinclude
//#cgo windows LDFLAGS: -Llib/x64 -lTolk
//#include "Tolk.h"
import "C"
// import "unsafe"
func Load() {
C.Tolk_Load()
}
func IsLoaded() bool {
if C.Tolk_IsLoaded() == false {
return false
}
return true
}
func Unload() {
C.Tolk_Unload()
}
// problem: the function I can't find a solution for.
func DetectScreenReader() string{
return C.GoString(C.Tolk_DetectScreenReader())
}
func HasBraille() bool{
b := C.Tolk_HasBraille()
if (b == false) {
return false }
return true
}
// problem: the second function I can't find a solution for ..
func Output(text string, interrupt bool) {
b := C.bool(bool)
C.Tolk_Output((*C.wchar_t)(text), b)
}
error: .\talker.go:39:28: cannot convert text (type string) to
type *_Ctype_ushort
👨🦯 I’m a software developer. I coding often Python, sometimes Go and rarely (C)/C++.
--
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 golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/aeaba06b-bb41-3e3a-3ee4-7993b8bb4596%40gmail.com.