* tree-vect-loop-manip.c (vect_do_peeling): Do not use
[official-gcc.git] / libgo / misc / cgo / test / api.go
blobd2b09cbeffedbc8fc46a89aabd38aeaa7f9d583b
1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // API Compatibility Checks for cgo
7 package cgotest
9 // #include <stdlib.h>
11 // // Test for issue 17723.
12 // typedef char *cstring_pointer;
13 // static void cstring_pointer_fun(cstring_pointer dummy) { }
15 // const char *api_hello = "hello!";
16 import "C"
17 import "unsafe"
19 func testAPI() {
20 var cs *C.char
21 cs = C.CString("hello")
22 defer C.free(unsafe.Pointer(cs))
23 var s string
24 s = C.GoString((*C.char)(C.api_hello))
25 s = C.GoStringN((*C.char)(C.api_hello), C.int(6))
26 var b []byte
27 b = C.GoBytes(unsafe.Pointer(C.api_hello), C.int(6))
28 _, _ = s, b
29 C.cstring_pointer_fun(nil)