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: support for gccgo #2313

Closed
rsc opened this issue Sep 28, 2011 · 24 comments
Closed

cmd/cgo: support for gccgo #2313

rsc opened this issue Sep 28, 2011 · 24 comments

Comments

@rsc
Copy link
Contributor

rsc commented Sep 28, 2011

Cgo-based packages that work with 6g should
also work with gccgo.  Right now cgo has no gccgo
support.

The runtime linkage between Go and C is obviously
easier in gccgo than in 6g.  The benefit of cgo in
the gccgo context is mainly the nice wrapping and
being able to build the same code in both 
environments.
@lvdlvd
Copy link

lvdlvd commented Nov 7, 2011

Comment 1:

Labels changed: added cgo, gccgo.

Owner changed to @lvdlvd.

@rsc
Copy link
Contributor Author

rsc commented Dec 9, 2011

Comment 2:

Labels changed: added priority-later, removed priority-medium.

@rsc
Copy link
Contributor Author

rsc commented Dec 12, 2011

Comment 3:

Labels changed: added priority-go1.

@lvdlvd
Copy link

lvdlvd commented Dec 15, 2011

@robpike
Copy link
Contributor

robpike commented Jan 13, 2012

Comment 5:

Owner changed to builder@golang.org.

@rsc
Copy link
Contributor Author

rsc commented Jan 24, 2012

Comment 6:

Remy, Ian: is this done?

@remyoudompheng
Copy link
Contributor

Comment 7:

I don't think so: it is missing a cgocall equivalent (is it a goal?) and support for
exports, and double returns for errno's.

@remyoudompheng
Copy link
Contributor

Comment 8:

Unsurprisingly, the Go-SDL (github.com/banthar/Go-SDL/sdl) example program compiles but
crashes with gccgo, libX11 wants a huge stack at some point.

@rsc
Copy link
Contributor Author

rsc commented Jan 30, 2012

Comment 9:

Labels changed: added go1-must.

@rsc
Copy link
Contributor Author

rsc commented Mar 8, 2012

Comment 10:

Is this implemented now, and working except for reported bugs?
If so, let's close this one.

@remyoudompheng
Copy link
Contributor

Comment 11:

Still missing the  supprt for exports. I don't know how to do it. I think it requires
cgo to have the knowledge of what symbols the Go functions will get, and use
void goCallback() __asm__("the_symbol_of_the_go_callback"); 
in C generated code. But last time I tried i got an undefined symbol.

@ianlancetaylor
Copy link
Member

Comment 12:

It should work if you use the right symbol name.  See
http://tip.golang.org/doc/install/gccgo#Function_names .  Don't ask about method names,
but presumably you aren't going to try to call them anyhow.

@minux
Copy link
Member

minux commented Mar 13, 2012

Comment 13:

Issue #3183 has been merged into this issue.

@remyoudompheng
Copy link
Contributor

Comment 14:

Now it misses:
* support for global variables (issue #3183)
* calling of inline functions (issue #3027)
* export of methods
* export of unexported functions (probably not going to happen?)

@alberts
Copy link
Contributor

alberts commented Mar 16, 2012

Comment 15:

I've also filed issue #3332 with a few more problems.

@ianlancetaylor
Copy link
Member

Comment 16:

We've got basic functionality.  Dropping the remaining items out of Go 1.

Labels changed: added priority-later, removed priority-go1, go1-must.

Owner changed to @ianlancetaylor.

@alberts
Copy link
Contributor

alberts commented Mar 21, 2012

Comment 17:

I was trying to find a workaround for the inlined functions:
http://stackoverflow.com/questions/1474030/how-can-i-tell-gcc-not-to-inline-a-function
I tried this the function pointer suggestion, but I got:
call of non-function C.foo_ptr
Might be nice if that could work. I think it will help when wrapping the JVM API too.

@ianlancetaylor
Copy link
Member

Comment 18:

Can you file a separate issue with a function pointer example?

@rsc
Copy link
Contributor Author

rsc commented Sep 12, 2012

Comment 19:

Labels changed: added go1.1maybe.

@rsc
Copy link
Contributor Author

rsc commented Mar 12, 2013

Comment 20:

[The time for maybe has passed.]

Labels changed: removed go1.1maybe.

@rsc
Copy link
Contributor Author

rsc commented Jul 30, 2013

Comment 21:

Labels changed: added go1.2maybe.

@robpike
Copy link
Contributor

robpike commented Aug 16, 2013

Comment 22:

Remaining items won't happen for Go 1.2. Deferring to Go 1.3

Labels changed: added go1.3maybe, removed go1.2maybe.

@robpike
Copy link
Contributor

robpike commented Aug 20, 2013

Comment 23:

Labels changed: removed go1.3maybe.

@ianlancetaylor
Copy link
Member

Comment 24:

All the tests in misc/cgo pass with gccgo, so I'm going to close this.
If you have specific issues using cgo with gccgo, please open a new issue.  Please do
not reopen this general issue.  Please do not add a comment about a specific problem to
this issue.  Open a new issue with specific details about the problem you've
encountered.  Thanks.

Status changed to Fixed.

@rsc rsc added fixed labels Oct 11, 2013
@golang golang locked and limited conversation to collaborators Jun 24, 2016
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

8 participants