Groups
Groups
Sign in
Groups
Groups
golang-nuts
Conversations
About
Send feedback
Help
cgo:build trouble
114 views
Skip to first unread message
liaoy...@gmail.com
unread,
Mar 18, 2019, 12:36:50 AM
3/18/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
package main
import(
)
/*
#include <stdio.h>
*/
import "C"
func main() {
C.printf(C.CString("hello"))
}
//---->build this file with go build, i got
//./testems.go:12:2: unexpected type: ...
could someone help me with this trouble? thanks!
Ian Lance Taylor
unread,
Mar 18, 2019, 11:25:54 PM
3/18/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to liaoy...@gmail.com, golang-nuts
Calling variadic C functions like printf is not supported. See the
docs (
https://golang.org/cmd/cgo
) for a workaround.
I admit the error message is not the best. Feel free to open an issue
to improve it, at
https://golang.org/issue
. Thanks.
Ian
Reply all
Reply to author
Forward
0 new messages