cgo: implement void* pointer type

void* is translated to unsafe.Pointer on the Go side.
This commit is contained in:
Ayke van Laethem
2019-04-20 15:48:45 +02:00
committed by Ron Evans
parent 9c46ac4eed
commit b815d3f760
5 changed files with 22 additions and 1 deletions
+2
View File
@@ -41,6 +41,8 @@ func main() {
println("complex double:", C.globalComplexDouble)
println("complex long double:", C.globalComplexLongDouble)
println("char match:", C.globalChar == 100)
var voidPtr unsafe.Pointer = C.globalVoidPtrNull
println("void* match:", voidPtr == nil, C.globalVoidPtrNull == nil, (*C.int)(C.globalVoidPtrSet) == &C.global)
// complex types
println("struct:", C.int(unsafe.Sizeof(C.globalStruct)) == C.globalStructSize, C.globalStruct.s, C.globalStruct.l, C.globalStruct.f)