Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(399)

Issue 853042: code review 853042: Add //export to cgo. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 2 months ago by iant
Modified:
15 years, 2 months ago
Reviewers:
CC:
rsc, golang-dev
Visibility:
Public.

Description

Add //export to cgo. The new //export comment marks a Go function as callable from C. The syntax is "//export NAME" where NAME is the name of the function as seen from C. If such a comment is seen, cgo will generate two new files: _cgo_export.h and _cgo_export.c. The _cgo_export.h file provides declarations which C code may use to call Go functions. The _cgo_export.c file contains wrappers, and is to be compiled with gcc. The changes to Make.pkg support using this from a Go Makefile, though it could probably be more convenient.

Patch Set 1 #

Patch Set 2 : code review 853042: Add //export to cgo. #

Patch Set 3 : code review 853042: Add //export to cgo. #

Patch Set 4 : code review 853042: Add //export to cgo. #

Patch Set 5 : code review 853042: Add //export to cgo. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+361 lines, -6 lines) Patch
M src/Make.pkg View 4 chunks +9 lines, -5 lines 0 comments Download
M src/cmd/cgo/ast.go View 1 5 chunks +45 lines, -0 lines 0 comments Download
M src/cmd/cgo/out.go View 1 2 3 4 6 chunks +307 lines, -1 line 0 comments Download

Messages

Total messages: 5
iant
Hello rsc (cc: golang-dev@googlegroups.com), I'd like you to review this change.
15 years, 2 months ago (2010-04-02 04:06:15 UTC) #1
rsc1
LGTM I wonder if instead of //export (which is fine for now) we should think ...
15 years, 2 months ago (2010-04-02 06:35:13 UTC) #2
iant2
rsc@google.com writes: > I wonder if instead of //export (which is fine for now) > ...
15 years, 2 months ago (2010-04-03 02:17:39 UTC) #3
rsc
LGTM Either way. It's easy to change later.
15 years, 2 months ago (2010-04-06 05:18:22 UTC) #4
iant
15 years, 2 months ago (2010-04-09 20:31:09 UTC) #5
*** Submitted as http://code.google.com/p/go/source/detail?r=09271c841e33 ***

Add //export to cgo.

The new //export comment marks a Go function as callable from
C.  The syntax is "//export NAME" where NAME is the name of
the function as seen from C.  If such a comment is seen, cgo
will generate two new files: _cgo_export.h and _cgo_export.c.
The _cgo_export.h file provides declarations which C code may
use to call Go functions.  The _cgo_export.c file contains
wrappers, and is to be compiled with gcc.

The changes to Make.pkg support using this from a Go Makefile,
though it could probably be more convenient.

R=rsc
CC=golang-dev
http://codereview.appspot.com/853042
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b