Commit 5adfe937 authored by Ian Lance Taylor's avatar Ian Lance Taylor

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
parent b97005c1
......@@ -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
......
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