Commit a307c5c9 authored by Shenghou Ma's avatar Shenghou Ma

misc/cgo/test: check API compatibility for cgo pseudo-functions

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9826043
parent 322c08f2
// Copyright 2013 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.
// API Compatibility Checks for cgo
package cgotest
// #include <stdlib.h>
// const char *api_hello = "hello!";
import "C"
import "unsafe"
func testAPI() {
var cs *C.char
cs = C.CString("hello")
defer C.free(unsafe.Pointer(cs))
var s string
s = C.GoString((*C.char)(C.api_hello))
s = C.GoStringN((*C.char)(C.api_hello), C.int(6))
var b []byte
b = C.GoBytes(unsafe.Pointer(C.api_hello), C.int(6))
_, _ = s, b
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment