{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/12516","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/12516/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/12516/comments","events_url":"https://api.github.com/repos/golang/go/issues/12516/events","html_url":"https://github.com/golang/go/issues/12516","id":105043756,"number":12516,"title":"runtime: throw in linked c++ library causes app crash even if caught, on windows platform","user":{"login":"superbaddude","id":7436343,"avatar_url":"https://avatars.githubusercontent.com/u/7436343?v=3","gravatar_id":"","url":"https://api.github.com/users/superbaddude","html_url":"https://github.com/superbaddude","followers_url":"https://api.github.com/users/superbaddude/followers","following_url":"https://api.github.com/users/superbaddude/following{/other_user}","gists_url":"https://api.github.com/users/superbaddude/gists{/gist_id}","starred_url":"https://api.github.com/users/superbaddude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superbaddude/subscriptions","organizations_url":"https://api.github.com/users/superbaddude/orgs","repos_url":"https://api.github.com/users/superbaddude/repos","events_url":"https://api.github.com/users/superbaddude/events{/privacy}","received_events_url":"https://api.github.com/users/superbaddude/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/golang/go/labels/OS-Windows","name":"OS-Windows","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/32","html_url":"https://github.com/golang/go/milestones/Go1.7Early","labels_url":"https://api.github.com/repos/golang/go/milestones/32/labels","id":1414136,"number":32,"title":"Go1.7Early","description":"","creator":{"login":"bradfitz","id":2621,"avatar_url":"https://avatars.githubusercontent.com/u/2621?v=3","gravatar_id":"","url":"https://api.github.com/users/bradfitz","html_url":"https://github.com/bradfitz","followers_url":"https://api.github.com/users/bradfitz/followers","following_url":"https://api.github.com/users/bradfitz/following{/other_user}","gists_url":"https://api.github.com/users/bradfitz/gists{/gist_id}","starred_url":"https://api.github.com/users/bradfitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradfitz/subscriptions","organizations_url":"https://api.github.com/users/bradfitz/orgs","repos_url":"https://api.github.com/users/bradfitz/repos","events_url":"https://api.github.com/users/bradfitz/events{/privacy}","received_events_url":"https://api.github.com/users/bradfitz/received_events","type":"User","site_admin":false},"open_issues":45,"closed_issues":16,"state":"open","created_at":"2015-11-16T16:57:54Z","updated_at":"2016-03-29T23:00:45Z","due_on":"2016-05-01T07:00:00Z","closed_at":null},"comments":12,"created_at":"2015-09-05T19:04:49Z","updated_at":"2016-04-07T21:09:17Z","closed_at":null,"body":"when compiling go code using cgo to link a c++ application that uses try/catch/throw logic, the golang app crashes immediately when an exception is thrown.  on linux, it performs as expected.  \r\n\r\ncode versions:\r\n    go version go1.5 windows/amd64\r\n    tdm64-gcc-5.1.0-2\r\n\r\nthe code that demonstrates issue can be found in https://gist.github.com/superbaddude/b52e60f2e8dee0868af2\r\n\r\nthe output from command on windows:\r\n\r\n    go test\r\n\r\n```\r\n=== RUN   Test_Callthrow_and_catch_exception\r\nException 0x20474343 0x1045e80 0x6161616161616161 0x7fff56cda1c8\r\nPC=0x7fff56cda1c8\r\nsignal arrived during external code execution\r\n\r\ngithub.com/superbaddude/testcgo._Cfunc_throw_and_catch_exception()\r\n\tgithub.com/superbaddude/testcgo/_test/_obj_test/_cgo_gotypes.go:37 +0x38\r\ngithub.com/superbaddude/testcgo.Callthrow_and_catch_exception()\r\n\tc:/Code/go/src/github.com/superbaddude/testcgo/throwe.go:9 +0x1b\r\ngithub.com/superbaddude/testcgo.Test_Callthrow_and_catch_exception(0xc08208e000)\r\n\tc:/Code/go/src/github.com/superbaddude/testcgo/throwe_test.go:6 +0x1b\r\ntesting.tRunner(0xc08208e000, 0x702d00)\r\n\tc:/go/src/testing/testing.go:456 +0x9f\r\ncreated by testing.RunTests\r\n\tc:/go/src/testing/testing.go:561 +0x874\r\n\r\ngoroutine 1 [chan receive]:\r\ntesting.RunTests(0x5e4f28, 0x702d00, 0x1, 0x1, 0x1)\r\n\tc:/go/src/testing/testing.go:562 +0x8b4\r\ntesting.(*M).Run(0xc082033ee8, 0xc0820583d0)\r\n\tc:/go/src/testing/testing.go:494 +0x77\r\nmain.main()\r\n\tgithub.com/superbaddude/testcgo/_test/_testmain.go:54 +0x11d\r\n\r\ngoroutine 17 [syscall, locked to thread]:\r\nruntime.goexit()\r\n\tc:/go/src/runtime/asm_amd64.s:1696 +0x1\r\nrax     0x0\r\nrbx     0x1045e80\r\nrcx     0x0\r\nrdi     0x1045ec0\r\nrsi     0x6d6850\r\nrbp     0x0\r\nrsp     0x24fc00\r\nr8      0x10\r\nr9      0x8735d0\r\nr10     0x1\r\nr11     0x3\r\nr12     0x8\r\nr13     0x5e2c36\r\nr14     0x9\r\nr15     0x8\r\nrip     0x7fff56cda1c8\r\nrflags  0x206\r\ncs      0x33\r\nfs      0x53\r\ngs      0x2b\r\nexit status 2\r\nFAIL\tgithub.com/superbaddude/testcgo\t0.914s\r\n```"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/207089196","html_url":"https://github.com/golang/go/issues/12516#issuecomment-207089196","issue_url":"https://api.github.com/repos/golang/go/issues/12516","id":207089196,"user":{"login":"drbo","id":6395399,"avatar_url":"https://avatars.githubusercontent.com/u/6395399?v=3","gravatar_id":"","url":"https://api.github.com/users/drbo","html_url":"https://github.com/drbo","followers_url":"https://api.github.com/users/drbo/followers","following_url":"https://api.github.com/users/drbo/following{/other_user}","gists_url":"https://api.github.com/users/drbo/gists{/gist_id}","starred_url":"https://api.github.com/users/drbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drbo/subscriptions","organizations_url":"https://api.github.com/users/drbo/orgs","repos_url":"https://api.github.com/users/drbo/repos","events_url":"https://api.github.com/users/drbo/events{/privacy}","received_events_url":"https://api.github.com/users/drbo/received_events","type":"User","site_admin":false},"created_at":"2016-04-07T21:09:17Z","updated_at":"2016-04-07T21:09:17Z","body":"The problem is that the Windows ABI requires that ALL frames through which an exception may propagate have stack unwind information.  The only functions that do not require it are functions from which no SEH exception may ever be thrown.  Transitively.  That means that ANY function that may call into C needs unwind info.\r\n\r\nOne alternative is to only call into C via an assembler trampoline that ensures no Go code is on the stack when C code is executing."}}