diff options
author | Ayke van Laethem <[email protected]> | 2018-11-30 12:45:38 +0100 |
---|---|---|
committer | Ayke van Laethem <[email protected]> | 2018-12-10 15:38:03 +0100 |
commit | c6069476a7d7f16bbd000004bf574a46d5d2222f (patch) | |
tree | 075a917dd973219f7845b93a148b94bbd1731f7e /testdata/cgo/main.go | |
parent | 0af7da9bff101070999cfe6a959f8c0791365243 (diff) | |
download | tinygo-c6069476a7d7f16bbd000004bf574a46d5d2222f.tar.gz tinygo-c6069476a7d7f16bbd000004bf574a46d5d2222f.zip |
cgo: do not rely on stdint.h to be available
Diffstat (limited to 'testdata/cgo/main.go')
-rw-r--r-- | testdata/cgo/main.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/testdata/cgo/main.go b/testdata/cgo/main.go index f37c95eb9..f4a5d4d8b 100644 --- a/testdata/cgo/main.go +++ b/testdata/cgo/main.go @@ -1,20 +1,20 @@ package main /* -#include <stdint.h> -int32_t fortytwo(void); -int32_t mul(int32_t a, int32_t b); -typedef int32_t myint; +int fortytwo(void); +typedef short myint; int add(int a, int b); */ import "C" +import "unsafe" + func main() { println("fortytwo:", C.fortytwo()) - println("mul:", C.mul(C.int32_t(3), 5)) println("add:", C.add(C.int(3), 5)) var x C.myint = 3 println("myint:", x, C.myint(5)) + println("myint size:", int(unsafe.Sizeof(x))) var y C.longlong = -(1 << 40) println("longlong:", y) } |