Comments (5)
I'm not so familiar with the new cgo rules, but I could reproduce the crash.
As I understood my tests, the main issue here is that we have to pass **C.char
, with the *C.char
being created with the make function of go. ie. make([]C.char, 0, len(ws)*4)
, which obviously creates a pointer to a go pointer, which falls in the restriction of the new cgo pointer rules.
What I think of as a solution is replacing all make([]C.char, 0, len(ws)*4)
to C.malloc
calls:
Which is a problem when it comes to putting data in inputAsCChars, because *C.char is not indexable.
So I created a putWcharAt
in the C preamble, but it feels bad to make so many cgo calls.
Anyway I can't test it right now, I need a HID device first, this afternoon, or tomorrow.
from cgo.wchar.
Still trying to fix it, this fork doesn't crash cgo anymore: https://github.com/vitaminwater/cgo.wchar/
But now the whole iconv thing is broken, output for tests is:
--- FAIL: TestStringConversion (0.00s)
wchar_test.go:18: Error on conversion. invalid argument
--- FAIL: TestWcharStringConversion (0.00s)
wchar_test.go:43: Error on conversion. illegal byte sequence
--- FAIL: TestRuneConversion (0.00s)
wchar_test.go:74: Error on conversion. invalid argument
(last test not displayed hangs forever)
Still lacking knowledge, if you could provide me with some input I might create a good pull request to fix it.
from cgo.wchar.
The first test says invalid argument
, when I check the desired conversions in convertGoStringToWcharString
I see that the tocode
parameter for iconv_open
is wchar_t
, which is not listed when I do a iconv -l
, how is that meant to work ?
from cgo.wchar.
Looks like the wchar_t type does not exist on OSX: http://www.firstobject.com/wchar_t-string-on-linux-osx-windows.htm
from cgo.wchar.
Further readings tend to make me think that cgo.wchar could be avoided thanks to golang's unicode
package. Is that right ?
Maybe it would be wise to remove cgo.wchar from go.hid ?
from cgo.wchar.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cgo.wchar.