Try using a terra function that takes (argc : int, argv : &rawstring). The 
main method takes an int, the number of arguments, and an array of that many 
strings.

This is comparable to the C main method.

There is a great example of this on the main page of http://terralang.org/.

On Tuesday, December 6, 2016 6:43:40 PM EST Will Rubin wrote:
> Lots of them:
> 
> For example when I type into the REPL
> 
> terra addone(a : int)
>    return a + 1
> end
> 
> the function is created.
> 
> typing print(addone(2)) shows the correct answer.
> 
> then typing terralib.saveobj("addone",{main=addone}) gives:
> llvm: program not executable
> and a stack trace to saveobj
> 
> (Other error messages are on the other thread I'm on. All seem to be
> about not finding things I'm now thinking would be in a C library or such.)
> 
> Just tried terralib.saveObj(...) in case there's a case sensitivity
> issue. Got error message:
> 
> [string "stdin"]:1: attempt to call field 'saveObj' (a nil value)
> stack traceback:
>          [string "stdin"]:1: in main chunk
> 
> --Will
> 
> On 12/6/2016 6:33 PM, [email protected] wrote:
> > It would help if you could tell us the error.
> > 
> > On Tuesday, December 6, 2016 6:33:55 PM EST Will Rubin wrote:
> >> Hmmm ... just can't get an executable out of Terra. I'm on Windows and
> >> not Linux. Default Windows system. Unzipped Terra as per the
> >> documentation. Can get some of the REPL examples to work. As soon as I
> >> try terralib.saveobj("MyExecutable",{ main = myMain }) I get an error.
> >> 
> >> Do I need to have a C compiler or such installed in order to create an
> >> executable?
> >> 
> >> --Will
> >> _______________________________________________
> >> terralang mailing list
> >> [email protected]
> >> https://mailman.stanford.edu/mailman/listinfo/terralang
> 
> _______________________________________________
> terralang mailing list
> [email protected]
> https://mailman.stanford.edu/mailman/listinfo/terralang


-- 
John M. Harris, Jr.
OpenBlox
https://openblox.org/
_______________________________________________
terralang mailing list
[email protected]
https://mailman.stanford.edu/mailman/listinfo/terralang

Reply via email to