{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/11955","labels_url":"https://api.github.com/repos/golang/go/issues/11955/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/11955/comments","events_url":"https://api.github.com/repos/golang/go/issues/11955/events","html_url":"https://github.com/golang/go/issues/11955","id":98291613,"number":11955,"title":"doc: for -buildmode=c-shared, document that //export requires import \"C\"","user":{"login":"asmaloney","id":391371,"avatar_url":"https://avatars.githubusercontent.com/u/391371?v=3","gravatar_id":"","url":"https://api.github.com/users/asmaloney","html_url":"https://github.com/asmaloney","followers_url":"https://api.github.com/users/asmaloney/followers","following_url":"https://api.github.com/users/asmaloney/following{/other_user}","gists_url":"https://api.github.com/users/asmaloney/gists{/gist_id}","starred_url":"https://api.github.com/users/asmaloney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asmaloney/subscriptions","organizations_url":"https://api.github.com/users/asmaloney/orgs","repos_url":"https://api.github.com/users/asmaloney/repos","events_url":"https://api.github.com/users/asmaloney/events{/privacy}","received_events_url":"https://api.github.com/users/asmaloney/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/golang/go/labels/Documentation","name":"Documentation","color":"aaffaa"}],"state":"open","locked":false,"assignee":{"login":"ianlancetaylor","id":3194333,"avatar_url":"https://avatars.githubusercontent.com/u/3194333?v=3","gravatar_id":"","url":"https://api.github.com/users/ianlancetaylor","html_url":"https://github.com/ianlancetaylor","followers_url":"https://api.github.com/users/ianlancetaylor/followers","following_url":"https://api.github.com/users/ianlancetaylor/following{/other_user}","gists_url":"https://api.github.com/users/ianlancetaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ianlancetaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianlancetaylor/subscriptions","organizations_url":"https://api.github.com/users/ianlancetaylor/orgs","repos_url":"https://api.github.com/users/ianlancetaylor/repos","events_url":"https://api.github.com/users/ianlancetaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ianlancetaylor/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/1","html_url":"https://github.com/golang/go/milestones/Go1.5","labels_url":"https://api.github.com/repos/golang/go/milestones/1/labels","id":905105,"number":1,"title":"Go1.5","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":15,"closed_issues":1096,"state":"open","created_at":"2014-12-16T02:26:41Z","updated_at":"2015-08-03T20:00:16Z","due_on":"2015-07-31T04:00:00Z","closed_at":null},"comments":4,"created_at":"2015-07-31T00:23:32Z","updated_at":"2015-08-03T20:00:17Z","closed_at":null,"body":"This may just be a misunderstanding of how this is supposed to work - if so I'd appreciate some guidance.\r\n\r\n*What version of Go are you using (go version)?*\r\n`go version go1.5beta3 darwin/amd64`\r\n\r\n*What operating system and processor architecture are you using?*\r\n`Mac OS X 10.10.4 Intel Core i7`\r\n\r\n*What did you do?*\r\nI'm trying to build a C archive to link to a C++ app.  I read the release notes and the **Go Execution Modes** doc.  The second document states:\r\n\r\n> The only callable symbols will be those functions marked as exported (by any package), as described in the cgo documentation.\r\n\r\nI wrote a small test:\r\n```go\r\npackage main\r\n\r\nimport \"log\"\r\n\r\n//export Foo\r\nfunc Foo() {\r\n\tlog.Println(\"Foo\")\r\n}\r\n\r\nfunc main() {\r\n\t// unused\r\n}\r\n```\r\n\r\n`go build -buildmode=c-archive`\r\n\r\n*What did you expect to see?*\r\n\r\nI expected it to create **foo.a** and a header file with *Foo* exported.\r\n\r\n*What did you see instead?*\r\n\r\nIt generated **foo.a**, but no header file.\r\n\r\n*nm* also doesn't show my function being exported:\r\n\r\n```\r\n$ nm -g foo.a\r\n\r\nfoo.a(000000.o):\r\n                 U ___stack_chk_fail\r\n                 U ___stack_chk_guard\r\n                 U ___stderrp\r\n00000000000001f0 T __cgo_sys_thread_start\r\n0000000000000360 T __cgo_wait_runtime_init_done\r\n                 U _abort\r\n00000000000004e1 T _crosscall_amd64\r\n                 U _fprintf\r\n                 U _fputc\r\n                 U _free\r\n                 U _fwrite\r\n                 U _malloc\r\n                 U _pthread_attr_destroy\r\n                 U _pthread_attr_getstacksize\r\n                 U _pthread_attr_init\r\n                 U _pthread_cond_broadcast\r\n                 U _pthread_cond_wait\r\n                 U _pthread_create\r\n                 U _pthread_key_create\r\n                 U _pthread_key_delete\r\n                 U _pthread_mutex_lock\r\n                 U _pthread_mutex_unlock\r\n                 U _pthread_setspecific\r\n                 U _pthread_sigmask\r\n                 U _setenv\r\n                 U _strerror\r\n                 U _unsetenv\r\n0000000000000470 T _x_cgo_free\r\n0000000000000000 T _x_cgo_init\r\n0000000000000430 T _x_cgo_malloc\r\n00000000000003c0 T _x_cgo_notify_runtime_init_done\r\n0000000000000400 T _x_cgo_setenv\r\n0000000000000300 T _x_cgo_sys_thread_create\r\n0000000000000480 T _x_cgo_thread_start\r\n0000000000000420 T _x_cgo_unsetenv\r\n\r\nfoo.a(go.o):\r\n00000000000b49f0 T __cgo_panic\r\n0000000000054fe0 T __cgo_topofstack\r\n00000000000b4a20 T _crosscall2\r\n                 U _x_cgo_free\r\n                 U _x_cgo_init\r\n                 U _x_cgo_malloc\r\n                 U _x_cgo_notify_runtime_init_done\r\n                 U _x_cgo_setenv\r\n                 U _x_cgo_sys_thread_create\r\n                 U _x_cgo_thread_start\r\n                 U _x_cgo_unsetenv\r\n```"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/127389439","html_url":"https://github.com/golang/go/issues/11955#issuecomment-127389439","issue_url":"https://api.github.com/repos/golang/go/issues/11955","id":127389439,"user":{"login":"gopherbot","id":8566911,"avatar_url":"https://avatars.githubusercontent.com/u/8566911?v=3","gravatar_id":"","url":"https://api.github.com/users/gopherbot","html_url":"https://github.com/gopherbot","followers_url":"https://api.github.com/users/gopherbot/followers","following_url":"https://api.github.com/users/gopherbot/following{/other_user}","gists_url":"https://api.github.com/users/gopherbot/gists{/gist_id}","starred_url":"https://api.github.com/users/gopherbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gopherbot/subscriptions","organizations_url":"https://api.github.com/users/gopherbot/orgs","repos_url":"https://api.github.com/users/gopherbot/repos","events_url":"https://api.github.com/users/gopherbot/events{/privacy}","received_events_url":"https://api.github.com/users/gopherbot/received_events","type":"User","site_admin":false},"created_at":"2015-08-03T20:00:17Z","updated_at":"2015-08-03T20:00:17Z","body":"CL https://golang.org/cl/13080 mentions this issue."}}