Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
cb58ed75
Commit
cb58ed75
authored
Jan 27, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgo: update for package global name space
Fixes #560. R=r CC=golang-dev
https://golang.org/cl/195051
parent
3e0ee6b5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
out.go
src/cmd/cgo/out.go
+5
-5
No files found.
src/cmd/cgo/out.go
View file @
cb58ed75
...
...
@@ -47,10 +47,10 @@ func (p *Prog) writeDefs() {
}
fmt
.
Fprintf
(
fgo2
,
"type _C_void [0]byte
\n
"
)
fmt
.
Fprintf
(
fc
,
cProlog
,
pkgroot
,
pkgroot
,
pkgroot
,
pkgroot
,
p
.
Package
,
p
.
Package
)
fmt
.
Fprintf
(
fc
,
cProlog
,
pkgroot
,
pkgroot
,
pkgroot
,
pkgroot
)
for
name
,
def
:=
range
p
.
Vardef
{
fmt
.
Fprintf
(
fc
,
"#pragma dynld
%s·_C_%s %s
\"
%s.so
\"\n
"
,
p
.
Package
,
name
,
name
,
path
)
fmt
.
Fprintf
(
fc
,
"#pragma dynld
·_C_%s %s
\"
%s.so
\"\n
"
,
name
,
name
,
path
)
fmt
.
Fprintf
(
fgo2
,
"var _C_%s "
,
name
)
printer
.
Fprint
(
fgo2
,
&
ast
.
StarExpr
{
X
:
def
.
Go
})
fmt
.
Fprintf
(
fgo2
,
"
\n
"
)
...
...
@@ -133,7 +133,7 @@ func (p *Prog) writeDefs() {
fmt
.
Fprintf
(
fc
,
"void (*_cgo_%s)(void*);
\n
"
,
name
)
fmt
.
Fprintf
(
fc
,
"
\n
"
)
fmt
.
Fprintf
(
fc
,
"void
\n
"
)
fmt
.
Fprintf
(
fc
,
"
%s·_C_%s(struct{uint8 x[%d];}p)
\n
"
,
p
.
Package
,
name
,
argSize
)
fmt
.
Fprintf
(
fc
,
"
·_C_%s(struct{uint8 x[%d];}p)
\n
"
,
name
,
argSize
)
fmt
.
Fprintf
(
fc
,
"{
\n
"
)
fmt
.
Fprintf
(
fc
,
"
\t
cgocall(_cgo_%s, &p);
\n
"
,
name
)
fmt
.
Fprintf
(
fc
,
"}
\n
"
)
...
...
@@ -279,14 +279,14 @@ const cProlog = `
#pragma dynld _cgo_free free "%s/libcgo.so"
void
%s
·_C_GoString(int8 *p, String s)
·_C_GoString(int8 *p, String s)
{
s = gostring((byte*)p);
FLUSH(&s);
}
void
%s
·_C_CString(String s, int8 *p)
·_C_CString(String s, int8 *p)
{
p = cmalloc(s.len+1);
mcpy((byte*)p, s.str, s.len);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment