{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/9457","labels_url":"https://api.github.com/repos/golang/go/issues/9457/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/9457/comments","events_url":"https://api.github.com/repos/golang/go/issues/9457/events","html_url":"https://github.com/golang/go/issues/9457","id":52953214,"number":9457,"title":"runtime/cgo: calling DLL's export function crashes on Windows","user":{"login":"eahydra","id":832246,"avatar_url":"https://avatars.githubusercontent.com/u/832246?v=3","gravatar_id":"","url":"https://api.github.com/users/eahydra","html_url":"https://github.com/eahydra","followers_url":"https://api.github.com/users/eahydra/followers","following_url":"https://api.github.com/users/eahydra/following{/other_user}","gists_url":"https://api.github.com/users/eahydra/gists{/gist_id}","starred_url":"https://api.github.com/users/eahydra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eahydra/subscriptions","organizations_url":"https://api.github.com/users/eahydra/orgs","repos_url":"https://api.github.com/users/eahydra/repos","events_url":"https://api.github.com/users/eahydra/events{/privacy}","received_events_url":"https://api.github.com/users/eahydra/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/golang/go/labels/os-windows","name":"os-windows","color":"ededed"},{"url":"https://api.github.com/repos/golang/go/labels/repo-main","name":"repo-main","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":21,"created_at":"2014-12-27T09:42:00Z","updated_at":"2015-01-03T00:11:33Z","closed_at":null,"body":"go1.4 windows amd64\r\nOS: Windows 7 sp1 64Bit\r\n\r\nI write a dll that exports some function. then I invoke these function in go through syscall. But it crashed. The error:\r\nException 0xc00000fd 0x1 0x33000 0x7fef5017237\r\nPC=0x7fef5017237\r\nsignal arrived during cgo execution\r\n\r\nsyscall.(*Proc).Call(0xc082004620, 0xc082049f58, 0x2, 0x2, 0xc, 0xc0820045c0, 0x0, 0x0)\r\n        c:/go/src/syscall/dll_windows.go:132 +0x36e\r\nsyscall.(*LazyProc).Call(0xc082007d40, 0xc082049f58, 0x2, 0x2, 0x4ff330, 0xc, 0x0, 0x0)\r\n        c:/go/src/syscall/dll_windows.go:279 +0x74\r\nmain.main()\r\n        D:/GoDll/godll.go:27 +0x1a1\r\nrax     0x40370\r\nrbx     0xc082049da8\r\nrcx     0xc0820045a0\r\nrdx     0xc0820045c0\r\nrdi     0x7fffffde000\r\nrsi     0xc082049e00\r\nrbp     0x57ab00\r\nrsp     0x6fe08\r\nr8      0x0\r\nr9      0xc082007d40\r\nr10     0x2f000\r\nr11     0x33000\r\nr12     0x9\r\nr13     0x0\r\nr14     0x0\r\nr15     0x0\r\nrip     0x7fef5017237\r\nrflags  0x7fe00010287\r\ncs      0x33\r\nfs      0x53\r\ngs      0x2b\r\n\r\nWhen I change the local variable that in Dll from stack to heap, the crash is disappeared, the result is correct.\r\n\r\nThe test code is at here: https://www.dropbox.com/s/ggxpmey59zex4lg/GoDll.zip?dl=0\r\nIf you haven't visual studio, you can download the execute files: https://www.dropbox.com/s/3rnan6sf1killge/GoDll_Binary.zip?dl=0\r\n\r\nYou can use VS2013 compile this.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/68575097","html_url":"https://github.com/golang/go/issues/9457#issuecomment-68575097","issue_url":"https://api.github.com/repos/golang/go/issues/9457","id":68575097,"user":{"login":"minux","id":135652,"avatar_url":"https://avatars.githubusercontent.com/u/135652?v=3","gravatar_id":"","url":"https://api.github.com/users/minux","html_url":"https://github.com/minux","followers_url":"https://api.github.com/users/minux/followers","following_url":"https://api.github.com/users/minux/following{/other_user}","gists_url":"https://api.github.com/users/minux/gists{/gist_id}","starred_url":"https://api.github.com/users/minux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minux/subscriptions","organizations_url":"https://api.github.com/users/minux/orgs","repos_url":"https://api.github.com/users/minux/repos","events_url":"https://api.github.com/users/minux/events{/privacy}","received_events_url":"https://api.github.com/users/minux/received_events","type":"User","site_admin":false},"created_at":"2015-01-03T00:11:33Z","updated_at":"2015-01-03T00:11:33Z","body":"some of the discussion is on the CL: https://golang.org/cl/2237\r\n\r\n@alexbrainman used http://play.golang.org/p/TKkNSAVYnw to prove that on 64-bit system,\r\nafter applying the CL, 32-bit Go program could create significantly less OS threads.\r\n\r\nHowever, it seems that even without the CL, my Windows XP VM is allocating 1MB stack\r\nfor each thread. See the screen shot below:\r\n![1mb_stack](https://cloud.githubusercontent.com/assets/135652/5600866/002e08ca-92b3-11e4-91fb-73f227528346.png)\r\n"}}