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: cgo is broken in 1.3 #8302

Closed
mattn opened this issue Jun 30, 2014 · 9 comments
Closed

cmd/cgo: cgo is broken in 1.3 #8302

mattn opened this issue Jun 30, 2014 · 9 comments

Comments

@mattn
Copy link
Member

mattn commented Jun 30, 2014

go-gtk is worked well on 1.2 but can't build on 1.3

See mattn/go-gtk#210

It seems that mismatch native types and cgo-generated types.
@ianlancetaylor
Copy link
Contributor

Comment 1:

It would be very helpful if you could give us a standalone example showing the problem.
Looking at the gtk bug I don't understand the issue.

Labels changed: added repo-main, release-go1.3.1.

@mattn
Copy link
Member Author

mattn commented Jul 2, 2014

Comment 2:

ok, I'll make the small example in later.
BTW, between go1.2 and go1.3, I don't have changes about the structure of cgo.

@adg
Copy link
Contributor

adg commented Jul 15, 2014

Comment 3:

Status changed to WaitingForReply.

@mattn
Copy link
Member Author

mattn commented Jul 15, 2014

Comment 4:

Try this:
------------------------
package main
/*
typedef struct {
  int n;
} _foo;
typedef struct _foo foo;
*/
import "C"
func main() {
    var cFoo C.foo
    println(cFoo.n)
}
------------------------
This worked on 1.2 but 1.3 doesn't.

@ianlancetaylor
Copy link
Contributor

Comment 5:

For that test case I get a similar failure with Go 1.2.2:
> ~/go5/bin/go build ~/foo.go
# command-line-arguments
/home/iant/foo.go:12: cFoo.n undefined (type [0]byte has no field or method n)

@rsc
Copy link
Contributor

rsc commented Aug 6, 2014

Comment 6:

Your test case is not a valid program.
typedef struct { ... } _foo;
typedef struct _foo foo;
are referring to two different _foo. The first is a type name, and the second is a
struct tag. They do not mean the same struct.
It may be that go-gtk is broken, but this test case is likely not the reason.
I believe the real problem was issue #8463, now fixed. Can you please try go-gtk at tip?
I tried to build it myself but my Ubuntu seems not to have gdk-2.0 or gthread-2.0
available.

@mattn
Copy link
Member Author

mattn commented Aug 7, 2014

Comment 7:

It seems fixed in latest go in repo.

@ianlancetaylor
Copy link
Contributor

Comment 8:

Thanks for the followup.

Status changed to Duplicate.

Merged into issue #8463.

@rsc
Copy link
Contributor

rsc commented Aug 11, 2014

Comment 9:

Labels changed: added release-none, removed release-go1.3.1.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants