]> Cypherpunks repositories - gostls13.git/commit
cmd/internal/ld, runtime: record argument size for cgo_dynimport stdcall syscalls
authorShenghou Ma <minux@golang.org>
Mon, 9 Mar 2015 03:04:48 +0000 (23:04 -0400)
committerMinux Ma <minux@golang.org>
Tue, 24 Mar 2015 03:22:26 +0000 (03:22 +0000)
commit6112e6e404755028b2995bde31ca6e4a6bfe14a8
treeb73cdec274c00c297e9862c65c007aa3d8ce152d
parent398f56fe22dff8463c7833088d05d6c3968a3051
cmd/internal/ld, runtime: record argument size for cgo_dynimport stdcall syscalls

When external linking, we must link to implib provided by mingw, so we must use
properly decorated names for stdcalls.

Because the feature is only used in the runtime, I've designed a new decoration
scheme so that we can use the same decorated name for both 386 and amd64.

A stdcall function named FooEx from bar16.dll which takes 3 parameters will be
imported like this:
//go:cgo_import_dynamic runtime._FooEx FooEx%3 "bar16.dll"
Depending on the size of uintptr, the linker will later transform it to _FooEx@12
or _FooEx@24.

This is in prepration for the next CL that adds external linking support for
windows/386.

Change-Id: I2d2ea233f976aab3f356f9b508cdd246d5013e2c
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/7163
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/internal/ld/pe.go
src/runtime/os1_windows.go