llvm-d

Moritz Maxeiner moritz at ucworks.org
Sat Mar 23 19:37:49 PDT 2013


On Sunday, 24 March 2013 at 01:35:28 UTC, Chris Cain wrote:
> On Saturday, 23 March 2013 at 21:19:14 UTC, Moritz Maxeiner 
> wrote:
>>
>> TLDR: Your example should now work, provided you fix what I 
>> previously mentioned. You can also look at sample/fibonacci.d 
>> which I used instead of your fac to confirm that you gist now 
>> works.
>>
>> - Moritz
>
> Awesome. Indeed, it now fully works (and JIT does work after 
> all! Thanks for showing me how to use that). Thanks for the 
> more interesting example in the README, it's extremely helpful. 
> And also thank you for taking some time to help with the issues 
> I was having.

No problem, writing that fibonacci example forced me to read up 
Stuff about LLVM I need to know anyway (for making the D API)^^
Just one thing I forgot to mention: When you're using 
llvm.util.memory.toCString you'll need to take care of the 
allocated memory yourself, or you'll get memory leaks. The 
example is a special case as all the c strings need to be kept 
aroound until program termination, anyway (since LLVM's global 
context exists until then and all the c strings used by LLVM 
internally), but that's not the case with all LLVM C functions 
with c string args.

- Moritz


More information about the Digitalmars-d-announce mailing list