mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 04:23:41 +00:00
cgo: added CBytes implementation
This commit is contained in:
Vendored
+2
@@ -165,6 +165,8 @@ func main() {
|
||||
println("C.GoString(nil):", C.GoString(nil))
|
||||
println("len(C.GoStringN(nil, 0)):", len(C.GoStringN(nil, 0)))
|
||||
println("len(C.GoBytes(nil, 0)):", len(C.GoBytes(nil, 0)))
|
||||
println("len(C.GoBytes(C.CBytes(nil),0)):", len(C.GoBytes(C.CBytes(nil), 0)))
|
||||
println(`rountrip CBytes:`, C.GoString((*C.char)(C.CBytes([]byte("hello\000")))))
|
||||
|
||||
// libc: test whether C functions work at all.
|
||||
buf1 := []byte("foobar\x00")
|
||||
|
||||
Vendored
+2
@@ -73,6 +73,8 @@ C.CStringN: 4 2 0 4 8
|
||||
C.GoString(nil):
|
||||
len(C.GoStringN(nil, 0)): 0
|
||||
len(C.GoBytes(nil, 0)): 0
|
||||
len(C.GoBytes(C.CBytes(nil),0)): 0
|
||||
rountrip CBytes: hello
|
||||
copied string: foobar
|
||||
CGo sqrt(3): +1.732051e+000
|
||||
C sqrt(3): +1.732051e+000
|
||||
|
||||
Reference in New Issue
Block a user