aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata/cgo
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2018-11-29 17:30:46 +0100
committerAyke van Laethem <[email protected]>2018-12-10 15:38:02 +0100
commite8c1b5ab6e6b5789deb1cf1bf0f16e920710d1c2 (patch)
tree39918372d665fadede9aa2a6e1d51de6e29191bb /testdata/cgo
parentecf6ffa62ed45791362952caffefeffea4d96ed7 (diff)
downloadtinygo-e8c1b5ab6e6b5789deb1cf1bf0f16e920710d1c2.tar.gz
tinygo-e8c1b5ab6e6b5789deb1cf1bf0f16e920710d1c2.zip
cgo: add support for C typedefs
Diffstat (limited to 'testdata/cgo')
-rw-r--r--testdata/cgo/main.go5
-rw-r--r--testdata/cgo/out.txt1
2 files changed, 5 insertions, 1 deletions
diff --git a/testdata/cgo/main.go b/testdata/cgo/main.go
index f2c5b533a..cd9279409 100644
--- a/testdata/cgo/main.go
+++ b/testdata/cgo/main.go
@@ -4,10 +4,13 @@ package main
#include <stdint.h>
int32_t fortytwo(void);
int32_t mul(int32_t a, int32_t b);
+typedef int32_t myint;
*/
import "C"
func main() {
println("fortytwo:", C.fortytwo())
- println("mul:", C.mul(int32(3), 5))
+ println("mul:", C.mul(C.int32_t(3), 5))
+ var x C.myint = 3
+ println("myint:", x, C.myint(5))
}
diff --git a/testdata/cgo/out.txt b/testdata/cgo/out.txt
index e89fc9131..ce0b312ad 100644
--- a/testdata/cgo/out.txt
+++ b/testdata/cgo/out.txt
@@ -1,2 +1,3 @@
fortytwo: 42
mul: 15
+myint: 3 5