mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/cgo: make C function pointers non-assignable
Fixes #7757. Fixes #8488. LGTM=iant R=iant CC=golang-codereviews https://golang.org/cl/118690044
This commit is contained in:
parent
e4d4787581
commit
11016f62d8
4 changed files with 23 additions and 2 deletions
|
|
@ -64,7 +64,7 @@ func (p *Package) writeDefs() {
|
|||
if !*gccgo && *importRuntimeCgo {
|
||||
fmt.Fprintf(fgo2, "import _ \"runtime/cgo\"\n\n")
|
||||
}
|
||||
fmt.Fprintf(fgo2, "type _ unsafe.Pointer\n\n")
|
||||
fmt.Fprintf(fgo2, "func _Cgo_ptr(ptr unsafe.Pointer) unsafe.Pointer { return ptr }\n\n")
|
||||
if *importSyscall {
|
||||
fmt.Fprintf(fgo2, "func _Cerrno(dst *error, x int32) { *dst = syscall.Errno(x) }\n")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue