Hello,

I am calling certain Windows API from Go code (without CGO), everything 
works flawlessly, but now I bumped into this issue.

I want to register a callback that accepts (also) a float as argument (
https://docs.microsoft.com/en-us/windows/win32/api/audiopolicy/nf-audiopolicy-iaudiosessionevents-onsimplevolumechanged)
 
and I get a runtime error:

panic: compileCallback: float arguments not supported

This panic is thrown at 
https://golang.org/src/runtime/syscall_windows.go#L125 

I tried to receive an uint32 and convert it with math.Float64frombits 
(well, basically just with some pointer arithmetic) but no luck.

This issue on Github (https://github.com/golang/go/issues/6510), which got 
fixed, is related, but there the syscall itself was returning floats, here 
is a callback to register with a syscall.

The questions are:
1) Can I work around this with some clever pointer conversion? From what I 
understand this is not the case since basically Go runtime is ignoring some 
CPU registers where that value is stored, am I right?
2) What is the philosophy behind the choice of not supporting this kind of 
stuff? Is something like: "Go runtime needs to support the basic syscall 
the language, its standard library and most users need, and for the rest C 
is the way"

A while back I though using CGO for these kind of stuff was the only way, 
few weeks ago I discover that this was not necessarily the case. I was 
thrilled I could write everything in Go, but maybe this is not true after 
all. Well, quite a journey. Of course I hope I am wrong

Thanks a lot,

Marco

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f9082f2f-3f00-4b4d-b6b4-96e7fbd338a4n%40googlegroups.com.

Reply via email to