Last active
August 9, 2016 07:28
-
-
Save xspager/43b9e3d3b4b926abe556c9e2f444db5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local target = terralib.newtarget { | |
--Triple = "x86_64-apple-darwin"; | |
Triple = "x86_64-pc-linux"; | |
-- CPU = ""; | |
Features = ""; | |
} | |
local C = terralib.includecstring([[ | |
#include <stdio.h> | |
typedef struct { | |
int a; | |
int b; | |
} foo; | |
]], {}, target) | |
terra main() | |
var v: C.foo | |
v.a = 1 | |
v.b = 2 | |
C.printf("%d %d\n", v.a, v.b) | |
end | |
terralib.saveobj("target", {main=main}, {}, target) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment