News for hackers. Stuff that matters.
Re:Simple Windows GUI Application Written in Go by _ph_ on Thursday June 23, 2016 @02:27PM (#11963282)
You can reference C header files from go. If you include a headerfile defining a constant "foo", then C.foo would give the value to the Go program. It is not overly elegant, but the Go-C interface is pretty usable.
Re:Simple Windows GUI Application Written in Go by vvanders on Thursday June 23, 2016 @03:49PM (#11963846)
Does that include macro pre-processing as well? There's a lot of stuff like WIN32_LEAN_AND_MEAN in there as well.
Re:Simple Windows GUI Application Written in Go by vetinari on Thursday June 23, 2016 @04:02PM (#11963905)
Yes, it is ran through C preprocessor. You can define for CFLAGS, CPPFLAGS or LDFLAGS in the form of special comment:

    // #cgo CFLAGS: -DYOUR_DEFINE
    // #cgo LDFLAGS: -lyourlib
    // #include <header.h>
    import "C"
Re:Simple Windows GUI Application Written in Go by _ph_ on Thursday June 23, 2016 @03:58PM (#11963880)
As far as I am aware, yes. Using "cgo" (by importing "C") you can include C header files, and all c source files are compiled together with the Go files in your package. So if you have a foo.c containing int foo(int) you can just call it from Go by

i := C.foo(C.int(j))

Assuming j is a Go int type.

Re:Simple Windows GUI Application Written in Go by vvanders on Thursday June 23, 2016 @04:02PM (#11963904)
So just some quick googling points to https://github.com/golang/go/issues/9601 which seems like it's still an open issue.

Either way if you're going to build UI for Windows C#/QT with an C FFI is the more sane way to go. Back when I worked on game engines most of the time we had the fast code down in native and used C# for the tools since it's such a productive framework compared to win32.