Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/cgo: no atexit support #4221

gopherbot opened this issue Oct 9, 2012 · 2 comments


Copy link

commented Oct 9, 2012

by eduard.castany:

What steps will reproduce the problem?
package main

#include <stdio.h>
void print() {
import "C"

func main() {

What is the expected output?

What do you see instead?

Which compiler are you using (5g, 6g, 8g, gccgo)?

Which operating system are you using?
linux 64

Which version are you using?  (run 'go version')
go version devel +2c2052f38c3c Tue Oct 09 09:55:57 2012 +0400

This comment has been minimized.

Copy link

commented Oct 9, 2012

Comment 1:

A Go program exiting does not call C's atexit handlers, so stdout does not get flushed.
If you add C.fflush() to your program, you'll get both lines.
I think we probably want to keep the current behavior: we've worked hard to avoid atexit

Labels changed: added priority-later, removed priority-triage.

Status changed to Thinking.


This comment has been minimized.

Copy link

commented Dec 9, 2012

Comment 2:

Yes, please use an explicit C.fflush.

Status changed to WorkingAsIntended.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015

@rsc rsc removed the go1.1 label Apr 14, 2015

@golang golang locked and limited conversation to collaborators Jun 24, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
2 participants
You can’t perform that action at this time.