From: Ian Lance Taylor Date: Fri, 14 Jan 2011 18:52:08 +0000 (-0800) Subject: cgo: In _cgo_main.c define all provided symbols as functions. X-Git-Tag: weekly.2011-01-19~57 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5adfe9375238421f3143c781996540acfcc77adc;p=gostls13.git cgo: In _cgo_main.c define all provided symbols as functions. This defines crosscall2 in a way that matches that real definition, and also defines _cgo_allocate and _cgo_panic to indicate that they are available to be called by code compiled with gcc. R=rsc CC=golang-dev https://golang.org/cl/4026041 --- diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go index c3f9ae60b1..c766166775 100644 --- a/src/cmd/cgo/out.go +++ b/src/cmd/cgo/out.go @@ -34,7 +34,9 @@ func (p *Package) writeDefs() { // Write C main file for using gcc to resolve imports. fmt.Fprintf(fm, "int main() { return 0; }\n") - fmt.Fprintf(fm, "int crosscall2;\n\n") + fmt.Fprintf(fm, "void crosscall2(void(*fn)(void*, int), void *a, int c) { }\n") + fmt.Fprintf(fm, "void _cgo_allocate(void *a, int c) { }\n") + fmt.Fprintf(fm, "void _cgo_panic(void *a, int c) { }\n") // Write second Go output: definitions of _C_xxx. // In a separate file so that the import of "unsafe" does not