mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 13:03:39 +00:00
cgo: add support for C typedefs
This commit is contained in:
Vendored
+4
-1
@@ -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))
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -1,2 +1,3 @@
|
||||
fortytwo: 42
|
||||
mul: 15
|
||||
myint: 3 5
|
||||
|
||||
Reference in New Issue
Block a user