Commit dab268fa authored by James Gray's avatar James Gray Committed by Russ Cox

cmd/cgo: allow for stdcall decorated dynimport names

To allow for stdcall decorated names on Windows, two changes were needed:
1. Change the symbol versioning delimiter '@' in cgo's dynimport output to a '#', and in cmd/ld when it parses dynimports.
2. Remove the "@N" decorator from the first argument of cgo's dynimport output (PE only).

Fixes #4607.

R=minux.ma, adg, rsc
CC=golang-dev
https://golang.org/cl/7047043
parent 475d86b6
......@@ -176,7 +176,7 @@ func dynimport(obj string) {
for _, s := range sym {
targ := s.Name
if s.Version != "" {
targ += "@" + s.Version
targ += "#" + s.Version
}
fmt.Fprintf(stdout, "#pragma dynimport %s %s %q\n", s.Name, targ, s.Library)
}
......@@ -218,7 +218,8 @@ func dynimport(obj string) {
}
for _, s := range sym {
ss := strings.Split(s, ":")
fmt.Fprintf(stdout, "#pragma dynimport %s %s %q\n", ss[0], ss[0], strings.ToLower(ss[1]))
name := strings.Split(ss[0], "@")[0]
fmt.Fprintf(stdout, "#pragma dynimport %s %s %q\n", name, ss[0], strings.ToLower(ss[1]))
}
return
}
......
......@@ -506,7 +506,7 @@ loaddynimport(char *file, char *pkg, char *p, int n)
}
name = expandpkg(name, pkg);
q = strchr(def, '@');
q = strchr(def, '#');
if(q)
*q++ = '\0';
s = lookup(name, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment