mirror of
https://github.com/golang/go
synced 2024-11-08 01:36:12 -07:00
39d4693bac
This makes it much easier to run individual failing subtests. Use $(go env CC) instead of always defaulting to clang; this makes it easier to test with other compilers. Run C binaries to detect incompatible compiler/kernel pairings instead of sniffing versions. updates #21196 Change-Id: I0debb3cc4a4244df44b825157ffdc97b5c09338d Reviewed-on: https://go-review.googlesource.com/52910 Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
34 lines
552 B
Go
34 lines
552 B
Go
// Copyright 2015 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
/*
|
|
extern int *GoFn(int *);
|
|
|
|
// Yes, you can have definitions if you use //export, as long as they are weak.
|
|
int f(void) __attribute__ ((weak));
|
|
|
|
int f() {
|
|
int i;
|
|
int *p = GoFn(&i);
|
|
if (*p != 12345)
|
|
return 0;
|
|
return 1;
|
|
}
|
|
*/
|
|
import "C"
|
|
|
|
//export GoFn
|
|
func GoFn(p *C.int) *C.int {
|
|
*p = C.int(12345)
|
|
return p
|
|
}
|
|
|
|
func main() {
|
|
if r := C.f(); r != 1 {
|
|
panic(r)
|
|
}
|
|
}
|