]> Cypherpunks repositories - gostls13.git/commitdiff
cgo: In _cgo_main.c define all provided symbols as functions.
authorIan Lance Taylor <iant@golang.org>
Fri, 14 Jan 2011 18:52:08 +0000 (10:52 -0800)
committerIan Lance Taylor <iant@golang.org>
Fri, 14 Jan 2011 18:52:08 +0000 (10:52 -0800)
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

src/cmd/cgo/out.go

index c3f9ae60b10d711a0077fa0ca950d1fe3078ea9b..c76616677520bb4fd8477dfc4c5a220575bce808 100644 (file)
@@ -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