diff --git a/src/cmd/cgo/doc.go b/src/cmd/cgo/doc.go index 9ff5fd41901c90..ef5272299bbf07 100644 --- a/src/cmd/cgo/doc.go +++ b/src/cmd/cgo/doc.go @@ -796,7 +796,7 @@ Instead, the build process generates an object file using dynamic linkage to the desired libraries. The main function is provided by _cgo_main.c: - int main() { return 0; } + int main(int argc, char **argv) { return 0; } void crosscall2(void(*fn)(void*), void *a, int c, uintptr_t ctxt) { } uintptr_t _cgo_wait_runtime_init_done(void) { return 0; } void _cgo_release_context(uintptr_t ctxt) { } diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go index 954c4b70c954eb..5e67cc2d334598 100644 --- a/src/cmd/cgo/out.go +++ b/src/cmd/cgo/out.go @@ -59,7 +59,7 @@ func (p *Package) writeDefs() { // Write C main file for using gcc to resolve imports. fmt.Fprintf(fm, "#include \n") // For size_t below. - fmt.Fprintf(fm, "int main() { return 0; }\n") + fmt.Fprintf(fm, "int main(int argc __attribute__((unused)), char **argv __attribute__((unused))) { return 0; }\n") if *importRuntimeCgo { fmt.Fprintf(fm, "void crosscall2(void(*fn)(void*) __attribute__((unused)), void *a __attribute__((unused)), int c __attribute__((unused)), size_t ctxt __attribute__((unused))) { }\n") fmt.Fprintf(fm, "size_t _cgo_wait_runtime_init_done(void) { return 0; }\n")