For the use of stdcall functions in cgo, it seems the only part of the Go toolchain that doesn't support them yet is cmd/ld. But, it does seem to handle them mostly ok. Currently when you try to call a stdcall function from cgo, ld prints out a "not defined" message from undef() in ld/lib.c, and if I disable this, the resulting binary actually seems to run without issue, updating and drawing a working OpenGL window.
Anyhow, my point is that it seems as though it would not be a great deal of work to have cmd/ld recognize these stdcall imports. Is this correct? I'd like to attempt to put together a CL to address this if that is the case. Guidance/suggestions are welcome.
Basically the stdcall symbols in the import name table has an arg size decorator (foo@0), so when cgo loads the import symbols with debug/pe to setup the dynimports used by cmd/ld, the symbols there also have the decorators. cmd/ld will load these as symbols just fine through loaddynimports(), but then the symbol used for the external dependency for the cgo call itself does not have the stdcall decorator (is foo, should be foo@0). You are right, though, perhaps the external function symbol should be correct in the first place.
Apologies if the terminology is off; I don't have much experience with this sort of code. I will put together a basic test case as soon as I can.