1
0
mirror of https://github.com/golang/go synced 2024-11-18 15:44:41 -07:00

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
This commit is contained in:
James Gray 2013-01-30 08:29:33 -08:00 committed by Russ Cox
parent 475d86b6d9
commit dab268fac3
2 changed files with 4 additions and 3 deletions

View File

@ -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
}

View File

@ -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);