aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2023-09-22 18:21:12 +0200
committerRon Evans <[email protected]>2023-09-24 07:41:26 -0700
commit6ef8fcd5379b9610c518ab893e878a4c9b37ba08 (patch)
tree43c14799d864cd0444320bfadc3ed187dbc437df /testdata
parenta896f7f218832667db9bb1ccf04b08c0bae63a8c (diff)
downloadtinygo-6ef8fcd5379b9610c518ab893e878a4c9b37ba08.tar.gz
tinygo-6ef8fcd5379b9610c518ab893e878a4c9b37ba08.zip
cgo: add C._Bool type
This fixes https://github.com/tinygo-org/tinygo/issues/3926. While working on this I've found another bug: if C.bool is referenced from within Go, it isn't available anymore on the C side. This is an existing bug that also applies to float and double, but may be less likely to be triggered there. This bug is something to be fixed at a later time (it has something to do with preprocessor defines).
Diffstat (limited to 'testdata')
-rw-r--r--testdata/cgo/main.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/testdata/cgo/main.go b/testdata/cgo/main.go
index 4555c922f..1b810a565 100644
--- a/testdata/cgo/main.go
+++ b/testdata/cgo/main.go
@@ -9,6 +9,7 @@ int mul(int, int);
#include <string.h>
#cgo CFLAGS: -DSOME_CONSTANT=17
#define someDefine -5 + 2 * 7
+bool someBool;
*/
import "C"
@@ -56,6 +57,9 @@ func main() {
var goInt8 int8 = 5
var _ C.int8_t = goInt8
+ var _ bool = C.someBool
+ var _ C._Bool = C.someBool
+
// more globals
println("bool:", C.globalBool, C.globalBool2 == true)
println("float:", C.globalFloat)