[cfe-dev] Compile MemoryBuffer

Alexei Svitkine alexei.svitkine at gmail.com
Wed Nov 3 15:30:06 PDT 2010


Take a look at ccons:

http://code.google.com/p/ccons/

-Alexei

On Wed, Nov 3, 2010 at 12:31 PM, David PirrĂ² <david.pirro at gmail.com> wrote:
> Dear Developers,
>
> First, thank you very much for your work.
> I believe clang is a great tool and I can't wait to use it in my programs.
>
> I'm totally new to clang, but I'm willing to learn.
> .... With your help :)
>
> I believe this has been asked already many times...
>
> So, here's my question:
> I would like to use clang in my application for scripting and definition jit-compilation of functions to be used as callbacks in the c++ application.
> This is the "big" (and unclear I know) frame.
> But let's go step by step...
>
> My question is how can I jit-compile and evaluate c / c++ code packed into a string like:
> "int foo(int a, int b) { int r; r=a+b; return r;}"
> and then in a subsequent step evaluate:
> "foo(2,3)"
>
> I think I understood this is done using MemoryBuffers.
> But I can't get it to work.
> I'm currently basing my experiments on the clang-interpreter example code.
>
> I know there are some code snippetts around the web about this issue but I can't get them all together working.
> It would be extremely helpful if someone could post some "working" code to do this so that I can then use, look, experiment and understand better what's going on.
> That would be great!
>
> Thank you very much for you help in advance.
>
> Bests,
>
> David
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list