cgo: add support for C typedefs

This commit is contained in:
Ayke van Laethem
2018-11-29 17:30:46 +01:00
parent ecf6ffa62e
commit e8c1b5ab6e
4 changed files with 122 additions and 21 deletions
+4 -1
View File
@@ -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))
}
+1
View File
@@ -1,2 +1,3 @@
fortytwo: 42
mul: 15
myint: 3 5