cgo: add support for #define constants

These are converted to Go constants where possible.
This commit is contained in:
Ayke van Laethem
2019-04-28 14:10:03 +02:00
committed by Ron Evans
parent eb0ce8a298
commit 99587fe073
6 changed files with 150 additions and 2 deletions
+4
View File
@@ -18,6 +18,10 @@ func main() {
var y C.longlong = -(1 << 40)
println("longlong:", y)
println("global:", C.global)
println("defined ints:", C.CONST_INT, C.CONST_INT2)
println("defined floats:", C.CONST_FLOAT, C.CONST_FLOAT2)
println("defined string:", C.CONST_STRING)
println("defined char:", C.CONST_CHAR)
var ptr C.intPointer
var n C.int = 15
ptr = C.intPointer(&n)