LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package cgotest | 5 package cgotest |
6 | 6 |
7 /* | 7 /* |
8 char* greeting = "hello, world"; | 8 char* greeting = "hello, world"; |
| 9 #cgo darwin/amd64 LDFLAGS: -lregexp |
| 10 #cgo linux CFLAGS: -m32 |
| 11 #cgo pkg-config: cairo moscow |
9 */ | 12 */ |
10 // #include "cgotest.h" | 13 // #include "cgotest.h" |
11 import "C" | 14 import "C" |
12 import "unsafe" | 15 import "unsafe" |
13 | 16 |
14 var Greeting = C.GoString(C.greeting) | 17 var Greeting = C.GoString(C.greeting) |
15 | 18 |
16 func DoAdd(x, y int) (sum int) { | 19 func DoAdd(x, y int) (sum int) { |
17 C.Add(C.int(x), C.int(y), (*C.int)(unsafe.Pointer(&sum))) | 20 C.Add(C.int(x), C.int(y), (*C.int)(unsafe.Pointer(&sum))) |
18 return | 21 return |
19 } | 22 } |
LEFT | RIGHT |